Commit 6dbd840d by 翁国栋

8小时后台--

日志列表
parent 4c70cf09
...@@ -4,6 +4,7 @@ import lombok.Data; ...@@ -4,6 +4,7 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Description TODO * @Description TODO
...@@ -15,9 +16,10 @@ public class OrderImportInfo implements Serializable { ...@@ -15,9 +16,10 @@ public class OrderImportInfo implements Serializable {
private static final long serialVersionUID = -6208327653541160864L; private static final long serialVersionUID = -6208327653541160864L;
private String uuid; private String uuid;
private String single_serial_no; private String single_serial_no;
private String third_uuid;
private String total_money; private String total_money;
private String endorsement_file; private String endorsement_file;
private String err_msg; private String err_msg;
private List err_list; private List<Map> err_list;
private String err_content; private String err_content;
} }
...@@ -51,28 +51,27 @@ public class CallBackContorll { ...@@ -51,28 +51,27 @@ public class CallBackContorll {
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
private Map insuredCallBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException { private Map insuredCallBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException {
Map map = Maps.newHashMap(); Map map = Maps.newHashMap();
map.put("status","error"); map.put("status", "error");
if(StringUtils.isNullOrEmpty(pid)||StringUtils.isNullOrEmpty(sign)&&StringUtils.isNullOrEmpty(timestamp)){ if (StringUtils.isNullOrEmpty(pid) || StringUtils.isNullOrEmpty(sign) && StringUtils.isNullOrEmpty(timestamp)) {
return map; return map;
} }
if(!pid.equals(appidq)){ if (!pid.equals(appidq)) {
return map; return map;
} }
InputStream is = null; InputStream is = null;
is = request.getInputStream(); is = request.getInputStream();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
byte[] b = new byte[4096]; byte[] b = new byte[4096];
for (int n; (n = is.read(b)) != -1;) for (int n; (n = is.read(b)) != -1; ) {
{
sb.append(new String(b, 0, n)); sb.append(new String(b, 0, n));
} }
String value = DigestUtils.md5Hex(appidq + secretq + timestamp + sb.toString()); String value = DigestUtils.md5Hex(appidq + secretq + timestamp + sb.toString());
if(!value.equals(sign)){ if (!value.equals(sign)) {
return map; return map;
} }
CallBack callBack=JSONObject.parseObject(sb.toString(), CallBack.class); CallBack callBack = JSONObject.parseObject(sb.toString(), CallBack.class);
Map trueMap = Maps.newHashMap(); Map trueMap = Maps.newHashMap();
trueMap.put("status","1"); trueMap.put("status", "1");
return trueMap; return trueMap;
} }
...@@ -81,67 +80,75 @@ public class CallBackContorll { ...@@ -81,67 +80,75 @@ public class CallBackContorll {
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
private Map callBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException { private Map callBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException {
Map map = Maps.newHashMap(); Map map = Maps.newHashMap();
map.put("status","error"); map.put("status", "error");
int type = 7; if (StringUtils.isNullOrEmpty(pid) || StringUtils.isNullOrEmpty(sign) && StringUtils.isNullOrEmpty(timestamp)) {
Integer policyId = null;
if(StringUtils.isNullOrEmpty(pid)||StringUtils.isNullOrEmpty(sign)&&StringUtils.isNullOrEmpty(timestamp)){
return map; return map;
} }
if(!pid.equals(appidq)){ if (!pid.equals(appidq)) {
return map; return map;
} }
InputStream is = null; InputStream is = null;
is = request.getInputStream(); is = request.getInputStream();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
byte[] b = new byte[4096]; byte[] b = new byte[4096];
for (int n; (n = is.read(b)) != -1;) for (int n; (n = is.read(b)) != -1; ) {
{
sb.append(new String(b, 0, n)); sb.append(new String(b, 0, n));
} }
String value = DigestUtils.md5Hex(appidq + secretq + timestamp + sb.toString()); String value = DigestUtils.md5Hex(appidq + secretq + timestamp + sb.toString());
if(!value.equals(sign)){ if (!value.equals(sign)) {
return map; return map;
} }
Map paramsMap = Maps.newHashMap(); Map paramsMap = Maps.newHashMap();
paramsMap.put("pid",pid); paramsMap.put("pid", pid);
paramsMap.put("timestamp",timestamp); paramsMap.put("timestamp", timestamp);
paramsMap.put("sign",sign); paramsMap.put("sign", sign);
CallBack callBack=JSONObject.parseObject(sb.toString(), CallBack.class); CallBack callBack = JSONObject.parseObject(sb.toString(), CallBack.class);
if(callBack.getStatus().equals("1")) { log.info("callBack=====" + sb.toString());
log.info("callBack" + JSONObject.toJSONString(callBack)); if (callBack.getStatus().equals("1")) {
List<InsureUser> list = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getBatchNo, callBack.getOrder_import_info().getUuid()).eq(InsureUser::getInsureStatus,3)); List<InsureUser> list = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getBatchNo, callBack.getOrder_import_info().getUuid()).eq(InsureUser::getInsureStatus, 3));
list.forEach(i -> { list.forEach(i -> {
i.setInsureStatus(1); i.setInsureStatus(1);
i.updateById(); i.updateById();
YgglMainEmp.builder().isInsure(1).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId())); YgglMainEmp.builder().isInsure(1).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId()));
}); });
List<InsureUser> oldlist = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getReplaceTransId, callBack.getOrder_import_info().getUuid())); List<InsureUser> oldlist = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getReplaceTransId, callBack.getOrder_import_info().getUuid()));
if(oldlist!=null&&oldlist.size()>0) { if (oldlist != null && oldlist.size() > 0) {
oldlist.forEach(i -> { oldlist.forEach(i -> {
i.setInsureStatus(4); i.setInsureStatus(4);
i.setStatus("2"); i.setStatus("2");
i.updateById(); i.updateById();
YgglMainEmp.builder().isInsure(0).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId())); YgglMainEmp.builder().isInsure(0).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getId, i.getUserId()));
}); });
type=8;
} }
InsurePolicy insurePolicy= InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getPolicyNo,list.get(0).getPolicyNo())); InsurePolicy insurePolicy = InsurePolicy.builder().build().selectOne(new QueryWrapper<InsurePolicy>().lambda().eq(InsurePolicy::getPolicyNo, list.get(0).getPolicyNo()));
policyId=insurePolicy.getId(); if (oldlist == null || oldlist.size() == 0) {
if(oldlist==null||oldlist.size()==0) {
insurePolicy.setTotalPremium(String.valueOf(Double.valueOf(insurePolicy.getTotalPremium()) + Double.valueOf(callBack.getOrder_import_info().getTotal_money()))); insurePolicy.setTotalPremium(String.valueOf(Double.valueOf(insurePolicy.getTotalPremium()) + Double.valueOf(callBack.getOrder_import_info().getTotal_money())));
} }
insurePolicy.setPolicyFile(callBack.getOrder_import_info().getEndorsement_file()); insurePolicy.setPolicyFile(callBack.getOrder_import_info().getEndorsement_file());
insurePolicy.setUpdateTime(new Date()); insurePolicy.setUpdateTime(new Date());
insurePolicy.updateById(); insurePolicy.updateById();
}else{ InsureLog.builder().requestParam(JSONObject.toJSONString(paramsMap)).type(7)
.requestData(sb.toString()).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(callBack)).requestPath(base_api_url + "/callBack/policy/CallBack")
.returnCode(callBack.getStatus()).returnMsg("更新成功").policyId(insurePolicy.getId()).build().insert();
} else {
String errorMsg = "";
InsureLog insureLog = InsureLog.builder().build().selectOne(new QueryWrapper<InsureLog>().lambda().eq(InsureLog::getTransId, callBack.getOrder_import_info().getThird_uuid()));
List<Map> errMap = callBack.getOrder_import_info().getErr_list();
if (errMap.size() > 0) {
for (int i = 0; i < errMap.size(); i++) {
errorMsg = errorMsg + ("姓名:"+errMap.get(i).get("name").toString()+",错误:"+errMap.get(i).get("err_content").toString() + ',');
}
} else {
errorMsg = callBack.getErr_msg();
}
//TODO 写入日志 //TODO 写入日志
InsureLog.builder().requestParam(JSONObject.toJSONString(paramsMap)).type(7)
.requestData(sb.toString()).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(callBack)).requestPath(base_api_url + "/callBack/policy/CallBack")
.returnCode(callBack.getStatus()).returnMsg(errorMsg).policyId(insureLog.getPolicyId()).build().insert();
} }
Map trueMap = Maps.newHashMap(); Map trueMap = Maps.newHashMap();
trueMap.put("status","1"); trueMap.put("status", "1");
InsureLog.builder().requestParam(JSONObject.toJSONString(paramsMap)).type(type)
.requestData(sb.toString()).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(callBack)).requestPath(base_api_url+"/callBack/policy/CallBack")
.returnCode(callBack.getStatus()).returnMsg(callBack.getOrder_import_info().getErr_msg()).policyId(policyId).build().insert();
return trueMap; return trueMap;
} }
} }
...@@ -436,7 +436,7 @@ public class InsureContorll { ...@@ -436,7 +436,7 @@ public class InsureContorll {
if (status.equals("5") || status.equals("6") || status.equals("7")) { if (status.equals("5") || status.equals("6") || status.equals("7")) {
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(2) InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(2)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(responData).requestPath(batchUrl) .requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(responData).requestPath(batchUrl)
.returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).policyId(insurePolicy.getId()).fileUrl(data.get("file_url").toString()).build().insert(); .returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).policyId(insurePolicy.getId()).transId("IS_" + insurePolicy.getOrgCode() + "_" + dtf2.format(now)).fileUrl(data.get("file_url").toString()).build().insert();
return ResultUtil.error("信息填写错误,请查看日志"); return ResultUtil.error("信息填写错误,请查看日志");
} else { } else {
List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(insureDto.getUserIds()); List<YgglMainEmp> ygglMainEmpList = ygglMainEmpMapper.selectListByIds(insureDto.getUserIds());
...@@ -616,6 +616,9 @@ public class InsureContorll { ...@@ -616,6 +616,9 @@ public class InsureContorll {
Map<String, Object> orderImportInfo = JSONObject.parseObject(JSONObject.toJSONString(data.get("order_import_info"))); Map<String, Object> orderImportInfo = JSONObject.parseObject(JSONObject.toJSONString(data.get("order_import_info")));
String status = orderImportInfo.get("status").toString(); String status = orderImportInfo.get("status").toString();
if (status.equals("5") || status.equals("6") || status.equals("7")) { if (status.equals("5") || status.equals("6") || status.equals("7")) {
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(2)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(responData).requestPath(batchUrl)
.returnCode(dataMap.get("errcode").toString()).returnMsg(dataMap.get("errmsg").toString()).policyId(insurePolicy.getId()).transId("RP_" + insurePolicy.getOrgCode() + "_" + dtf2.format(now)).fileUrl(data.get("file_url").toString()).build().insert();
//TODO 写入日志 //TODO 写入日志
return ResultUtil.error("信息填写错误,请查看日志"); return ResultUtil.error("信息填写错误,请查看日志");
} else { } else {
...@@ -857,4 +860,5 @@ public class InsureContorll { ...@@ -857,4 +860,5 @@ public class InsureContorll {
return ResultUtil.data(list); return ResultUtil.data(list);
} }
} }
...@@ -14,12 +14,17 @@ import java.util.Map; ...@@ -14,12 +14,17 @@ import java.util.Map;
import cn.timer.api.bean.insure.InsureLog; import cn.timer.api.bean.insure.InsureLog;
import cn.timer.api.bean.insure.InsureProduct; import cn.timer.api.bean.insure.InsureProduct;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.dao.insure.InsureLogMapper; import cn.timer.api.dao.insure.InsureLogMapper;
import cn.timer.api.dto.insure.PolicyLogDto;
import cn.timer.api.utils.Page;
import cn.timer.api.utils.Result; import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil; import cn.timer.api.utils.ResultUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.aliyun.oss.common.utils.StringUtils; import com.aliyun.oss.common.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Maps;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -33,8 +38,6 @@ import javax.servlet.http.HttpServletResponse; ...@@ -33,8 +38,6 @@ import javax.servlet.http.HttpServletResponse;
/** /**
*
*
* @author wgd * @author wgd
* @email 862422848@qq.com * @email 862422848@qq.com
* @date 2022-03-22 09:55:46 * @date 2022-03-22 09:55:46
...@@ -43,7 +46,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -43,7 +46,7 @@ import javax.servlet.http.HttpServletResponse;
@RestController @RestController
@Transactional @Transactional
@RequestMapping(value = "/insureLog", produces = {"application/json"}) @RequestMapping(value = "/insureLog", produces = {"application/json"})
public class InsureLogController{ public class InsureLogController {
@Autowired @Autowired
private InsureLogMapper insureLogMapper; private InsureLogMapper insureLogMapper;
...@@ -51,16 +54,17 @@ public class InsureLogController{ ...@@ -51,16 +54,17 @@ public class InsureLogController{
@ApiOperation(value = "12.日志列表", httpMethod = "Get", notes = "日志列表") @ApiOperation(value = "12.日志列表", httpMethod = "Get", notes = "日志列表")
public Result<Object> logList(@RequestParam("policyId") String policyId) { public Result<Object> logList(@RequestParam("policyId") String policyId) {
List<InsureLog> list = insureLogMapper.selectListById(policyId); List<InsureLog> list = insureLogMapper.selectListById(policyId);
if (list.size()>0) { if (list.size() > 0) {
return ResultUtil.data(list); return ResultUtil.data(list);
} }
return ResultUtil.error("暂无日志"); return ResultUtil.error("暂无日志");
} }
@GetMapping(value = "/downUserExcel") @GetMapping(value = "/downUserExcel")
@ApiOperation(value = "12.人员清单", httpMethod = "Get", notes = "人员清单") @ApiOperation(value = "12.人员清单", httpMethod = "Get", notes = "人员清单")
public void downUserExcel(@RequestParam("logId") String logId, HttpServletRequest request, HttpServletResponse response) { public void downUserExcel(@RequestParam("logId") String logId, HttpServletRequest request, HttpServletResponse response) {
InsureLog insureLog = InsureLog.builder().id(Integer.parseInt(logId)).build().selectById(); InsureLog insureLog = InsureLog.builder().id(Integer.parseInt(logId)).build().selectById();
if(insureLog==null|| StringUtils.isNullOrEmpty(insureLog.getFileUrl())){ if (insureLog == null || StringUtils.isNullOrEmpty(insureLog.getFileUrl())) {
return; return;
} }
DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
...@@ -68,10 +72,10 @@ public class InsureLogController{ ...@@ -68,10 +72,10 @@ public class InsureLogController{
BufferedInputStream bis = null; BufferedInputStream bis = null;
try { try {
response.setContentType("application/octet-stream"); response.setContentType("application/octet-stream");
response.setHeader("content-disposition", "attachment; filename=" + new String((dtf2.format(LocalDateTime.now())+".xlsx").getBytes("UTF8"), "ISO-8859-1")); response.setHeader("content-disposition", "attachment; filename=" + new String((dtf2.format(LocalDateTime.now()) + ".xlsx").getBytes("UTF8"), "ISO-8859-1"));
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
sos = response.getOutputStream(); sos = response.getOutputStream();
String destUrl ="http:"+insureLog.getFileUrl(); String destUrl = "http:" + insureLog.getFileUrl();
URL url = new URL(destUrl); URL url = new URL(destUrl);
HttpURLConnection httpUrl = (HttpURLConnection) url.openConnection(); HttpURLConnection httpUrl = (HttpURLConnection) url.openConnection();
//连接指定的网络资源 //连接指定的网络资源
...@@ -100,4 +104,14 @@ public class InsureLogController{ ...@@ -100,4 +104,14 @@ public class InsureLogController{
} }
} }
@PostMapping(value = "/insureLogList")
@ApiOperation(value = "日志列表--8小时端", httpMethod = "Get", notes = "日志列表")
public Result<Object> insureLogList(@CurrentUser UserBean userBean, @RequestBody Page page) {
Map map = Maps.newHashMap();
List<PolicyLogDto> list = insureLogMapper.selectLogListByOrgCode(userBean.getOrgCode(),page);
map.put("list", list);
map.put("total", insureLogMapper.selectLogTotalByOrgCode(userBean.getOrgCode()));
return ResultUtil.data(map);
}
} }
package cn.timer.api.dao.insure; package cn.timer.api.dao.insure;
import cn.timer.api.bean.insure.InsureLog; import cn.timer.api.bean.insure.InsureLog;
import cn.timer.api.dto.insure.PolicyLogDto;
import cn.timer.api.utils.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sun.xml.internal.ws.policy.privateutil.PolicyLogger;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -19,5 +22,7 @@ import java.util.List; ...@@ -19,5 +22,7 @@ import java.util.List;
public interface InsureLogMapper extends BaseMapper<InsureLog> { public interface InsureLogMapper extends BaseMapper<InsureLog> {
List<InsureLog> selectListById(@Param("policyId")String policyId); List<InsureLog> selectListById(@Param("policyId")String policyId);
List<InsureLog> selectListByIds(@Param("array")Integer[] ids); List<InsureLog> selectListByIds(@Param("array")Integer[] ids);
List<PolicyLogDto> selectLogListByOrgCode(@Param("orgCode") Integer orgCode, @Param("page") Page page);
Integer selectLogTotalByOrgCode(@Param("orgCode") Integer orgCode);
} }
...@@ -184,4 +184,18 @@ ...@@ -184,4 +184,18 @@
#{id} #{id}
</foreach> </foreach>
</select> </select>
<select id="selectLogListByOrgCode" resultType="cn.timer.api.dto.insure.PolicyLogDto">
select ip.policy_no as policyNo,il.return_code as returnCode,il.return_msg as returnMsg,il.type as type,il.create_time as createTime from insure_log il
LEFT JOIN insure_policy ip on ip.id=il.policy_id
WHERE ip.org_code = #{orgCode}
<if test="page.currentPage != null and page.totalPage != null">
limit #{page.offset}, #{page.totalPage}
</if>
</select>
<select id="selectLogTotalByOrgCode" resultType="java.lang.Integer">
select count(il.id) from insure_log il
LEFT JOIN insure_policy ip on ip.id=il.policy_id
WHERE ip.org_code = #{orgCode}
</select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment