Commit 34c7bbf1 by 翁国栋 Committed by 284718418@qq.com

8小时后台--

保单在线支付
parent 5dc0935d
...@@ -22,3 +22,6 @@ MODIFY COLUMN `lzyy` varchar(800) CHARACTER SET utf8 COLLATE utf8_general_ci NUL ...@@ -22,3 +22,6 @@ MODIFY COLUMN `lzyy` varchar(800) CHARACTER SET utf8 COLLATE utf8_general_ci NUL
ALTER TABLE yggl_main_emp` ALTER TABLE yggl_main_emp`
ADD COLUMN `zpgl_zj_id` int(11) NULL DEFAULT NULL COMMENT '职级字典id' AFTER `zpgl_gzdd_id`; ADD COLUMN `zpgl_zj_id` int(11) NULL DEFAULT NULL COMMENT '职级字典id' AFTER `zpgl_gzdd_id`;
ALTER TABLE `timer_test`.`insure_user`
ADD COLUMN `create_time` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '创建时间' AFTER `reason`;
...@@ -170,3 +170,30 @@ INSERT INTO `timer_test`.`qyzx_admin_menu`(`id`, `menu_code`, `menu_name`, `sort ...@@ -170,3 +170,30 @@ INSERT INTO `timer_test`.`qyzx_admin_menu`(`id`, `menu_code`, `menu_name`, `sort
ALTER TABLE `timer_test`.`insure_user` ALTER TABLE `timer_test`.`insure_user`
ADD COLUMN `reason` varchar(255) NULL COMMENT '批改原因' AFTER `apply_type`; ADD COLUMN `reason` varchar(255) NULL COMMENT '批改原因' AFTER `apply_type`;
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for insure_pay
-- ----------------------------
DROP TABLE IF EXISTS `insure_pay`;
CREATE TABLE `insure_pay` (
`id` int(11) NOT NULL COMMENT 'id',
`pay_status` int(11) NULL DEFAULT NULL COMMENT '1已支付 2未支付 3已超时',
`amount` double NULL DEFAULT NULL COMMENT '支付金额',
`pay_time` datetime(0) NULL DEFAULT NULL COMMENT '支付时间',
`end_time` datetime(0) NULL DEFAULT NULL COMMENT '超时时间',
`pay_serial_no` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '支付流水号',
`pay_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '支付类型',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '支付流水表' ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
ALTER TABLE `insure_product`
ADD COLUMN `pay_type` int(11) NULL DEFAULT NULL COMMENT '1 在线支付 2预付款 3线下支付' AFTER `is_del`;
ALTER TABLE `insure_policy`
ADD COLUMN `policy_pay_type` int(11) NOT NULL DEFAULT 1 COMMENT '1在线支付 2预付款 3线下支付' AFTER `create_time`,
ADD COLUMN `pay_id` int(11) NULL DEFAULT NULL COMMENT 'insure_pay表的id' AFTER `policy_pay_type`;
...@@ -13,7 +13,17 @@ import java.util.List; ...@@ -13,7 +13,17 @@ import java.util.List;
@Data @Data
public class CallBack implements Serializable { public class CallBack implements Serializable {
private static final long serialVersionUID = 61499950876094044L; private static final long serialVersionUID = 61499950876094044L;
/**
* 0失败 1成功
* 保全复核回调:0代表核保失败,1代表核保成功,核保成功才可调用支付
* 保全批单回调:0代表保全失败,1代表保全成功
*/
private String status; private String status;
/**
* 1保全复核回调
* 2保全批单回调
*/
private String callback_type;
private String policy_status; private String policy_status;
private String err_msg; private String err_msg;
private String policy_no; private String policy_no;
......
package cn.timer.api.bean.insure;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
* 支付流水表
*
* @author wgd
* @email 862422848@qq.com
* @date 2022-05-18 19:33:23
*/
@Entity
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "insure_pay")
@ApiModel("支付流水表")
public class InsurePay extends Model<InsurePay> {
private static final long serialVersionUID = 1L;
/**
* id
*/
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号")
private Integer id;
/**
* 1已支付 2未支付 3已超时
*/
private Integer payStatus;
/**
* 支付金额
*/
private Double amount;
/**
* 支付时间
*/
private Date payTime;
/**
* 超时时间
*/
private Date endTime;
/**
* 支付流水号
*/
private String paySerialNo;
/**
* 支付类型
*/
private String payType;
private Integer policyId;
private String serialNumber;
/**
* 设置:id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取:id
*/
public Integer getId() {
return id;
}
/**
* 设置:1已支付 2未支付 3已超时
*/
public void setPayStatus(Integer payStatus) {
this.payStatus = payStatus;
}
/**
* 获取:1已支付 2未支付 3已超时
*/
public Integer getPayStatus() {
return payStatus;
}
/**
* 设置:支付金额
*/
public void setAmount(Double amount) {
this.amount = amount;
}
/**
* 获取:支付金额
*/
public Double getAmount() {
return amount;
}
/**
* 设置:支付时间
*/
public void setPayTime(Date payTime) {
this.payTime = payTime;
}
/**
* 获取:支付时间
*/
public Date getPayTime() {
return payTime;
}
/**
* 设置:超时时间
*/
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
/**
* 获取:超时时间
*/
public Date getEndTime() {
return endTime;
}
/**
* 设置:支付流水号
*/
public void setPaySerialNo(String paySerialNo) {
this.paySerialNo = paySerialNo;
}
/**
* 获取:支付流水号
*/
public String getPaySerialNo() {
return paySerialNo;
}
/**
* 设置:支付类型
*/
public void setPayType(String payType) {
this.payType = payType;
}
/**
* 获取:支付类型
*/
public String getPayType() {
return payType;
}
}
...@@ -87,7 +87,7 @@ public class InsurePolicy extends Model<InsurePolicy> { ...@@ -87,7 +87,7 @@ public class InsurePolicy extends Model<InsurePolicy> {
*/ */
private String totalPremium; private String totalPremium;
/** /**
* 1-正常 * 1-正常 2-等待校验 3-失效 4支付中
*/ */
private String status; private String status;
/** /**
...@@ -117,4 +117,14 @@ public class InsurePolicy extends Model<InsurePolicy> { ...@@ -117,4 +117,14 @@ public class InsurePolicy extends Model<InsurePolicy> {
private Integer productId; private Integer productId;
/**
* 1在线支付 2预付款 3线下支付
*/
private Integer policyPayType;
/**
* insure_pay表的id
*/
private Integer payId;
} }
...@@ -70,6 +70,11 @@ public class InsureProduct extends Model<InsureProduct> { ...@@ -70,6 +70,11 @@ public class InsureProduct extends Model<InsureProduct> {
private Integer isDel; private Integer isDel;
/** /**
* 1 在线支付 2预付款 3线下支付
*/
private Integer payType;
/**
* 设置:id * 设置:id
*/ */
public void setId(Integer id) { public void setId(Integer id) {
......
package cn.timer.api.bean.insure;
import lombok.Data;
/**
* @Description 支付回调
* @Author wgd
* @Date 2022/5/17 15:26
*/
@Data
public class PayCallBack {
private String serial_number;
private String pay_status;
private String pay_serial_no;
private String pay_time;
private String amount;
private String pay_type;
}
package cn.timer.api.bean.insure;
import lombok.Data;
/**
* @Description TODO
* @Author wgd
* @Date 2022/5/20 18:34
*/
@Data
public class PolicyCallBack {
private String status;
private String policy_status;
private String err_msg;
private String policy_no;
private String serial_number;
private String quote_trans_id;
private String serial_no;
private String policy_file;
private String kit_url;
private String total_premium;
}
package cn.timer.api.controller.insure; package cn.timer.api.controller.insure;
import cn.timer.api.bean.insure.CallBack; import cn.timer.api.bean.insure.*;
import cn.timer.api.bean.insure.InsureLog;
import cn.timer.api.bean.insure.InsurePolicy;
import cn.timer.api.bean.insure.InsureUser;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.utils.HttpUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
...@@ -25,6 +23,7 @@ import java.io.InputStream; ...@@ -25,6 +23,7 @@ import java.io.InputStream;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random;
/** /**
* @Description TODO * @Description TODO
...@@ -37,18 +36,47 @@ import java.util.Map; ...@@ -37,18 +36,47 @@ import java.util.Map;
@RequestMapping(value = "/callBack/policy", produces = {"application/json"}) @RequestMapping(value = "/callBack/policy", produces = {"application/json"})
public class CallBackContorll { public class CallBackContorll {
private static final Logger log = LoggerFactory.getLogger(CallBackContorll.class); private static final Logger log = LoggerFactory.getLogger(CallBackContorll.class);
@Value("${insure.appid}")
private String appid;
@Value("${insure.secret}")
private String secret;
/*保全测试用*/ /*保全测试用*/
@Value("${insure.appidq}") @Value("${insure.appidq}")
private String appidq; private String appidq;
@Value("${insure.secretq}") @Value("${insure.secretq}")
private String secretq; private String secretq;
@Value("${insure.getPolicyUrl}")
private String getPolicyUrl;
@Value("${BASE_API_URL}") @Value("${BASE_API_URL}")
private String base_api_url; private String base_api_url;
private Map setParams(String sign, String appid, String secret) {
/*当前时间戳*/
long timestamp = System.currentTimeMillis() / 1000;
log.info("时间戳" + timestamp);
Map paramsMap = Maps.newHashMap();
paramsMap.put("pid", appid);
paramsMap.put("timestamp", String.valueOf(timestamp));
paramsMap.put("trace_id", appid + timestamp + new Random().nextInt((9999 - 100) + 1) + 10);
// paramsMap.put("sign",Md5.md5(appid+secret+timestamp+sign.trim()));
String value;
if (sign == null) {
value = appid + secret + timestamp;
} else {
value = appid + secret + timestamp + sign;
log.info("body参数======" + sign);
}
paramsMap.put("sign", DigestUtils.md5Hex(value));
log.info("params参数======" + JSONObject.toJSONString(paramsMap));
return paramsMap;
}
@PostMapping(value = "/insuredCallBack") @PostMapping(value = "/insuredCallBack")
@ApiOperation(value = "6.投保申请回调", httpMethod = "POST", notes = "投保申请回调") @ApiOperation(value = "6.投保申请回调", httpMethod = "POST", notes = "投保申请回调")
@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");
...@@ -77,7 +105,6 @@ public class CallBackContorll { ...@@ -77,7 +105,6 @@ public class CallBackContorll {
@PostMapping(value = "/CallBack") @PostMapping(value = "/CallBack")
@ApiOperation(value = "7.保全增员申请回调", httpMethod = "POST", notes = "投保申请回调") @ApiOperation(value = "7.保全增员申请回调", httpMethod = "POST", notes = "投保申请回调")
@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");
...@@ -103,6 +130,11 @@ public class CallBackContorll { ...@@ -103,6 +130,11 @@ public class CallBackContorll {
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);
/*1保全复核回调*/
if (callBack.getCallback_type().equals("1")) {
} else {
/*到这就已经支付成功出单了*/
log.info("callBack=====" + sb.toString()); log.info("callBack=====" + sb.toString());
if (callBack.getStatus().equals("1")) { 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));
...@@ -136,7 +168,7 @@ public class CallBackContorll { ...@@ -136,7 +168,7 @@ public class CallBackContorll {
List<Map> errMap = callBack.getOrder_import_info().getErr_list(); List<Map> errMap = callBack.getOrder_import_info().getErr_list();
if (errMap.size() > 0) { if (errMap.size() > 0) {
for (int i = 0; i < errMap.size(); i++) { for (int i = 0; i < errMap.size(); i++) {
errorMsg = errorMsg + ("姓名:"+errMap.get(i).get("name").toString()+",错误:"+errMap.get(i).get("err_content").toString() + ','); errorMsg = errorMsg + ("姓名:" + errMap.get(i).get("name").toString() + ",错误:" + errMap.get(i).get("err_content").toString() + ',');
} }
} else { } else {
errorMsg = callBack.getErr_msg(); errorMsg = callBack.getErr_msg();
...@@ -146,9 +178,119 @@ public class CallBackContorll { ...@@ -146,9 +178,119 @@ public class CallBackContorll {
.requestData(sb.toString()).createTime(new Date()).requestType(1).returnBody(JSONObject.toJSONString(callBack)).requestPath(base_api_url + "/callBack/policy/CallBack") .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(); .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");
return trueMap; return trueMap;
} }
@GetMapping(value = "/payStatus")
@ApiOperation(value = "8.支付完成跳转", httpMethod = "GET", notes = "用于支付时跳回我们系统更新状态")
private void callBackPayStatus(HttpServletRequest request, @RequestParam Integer policyId) throws IOException {
log.info("支付完成回调(仅代表用户点了已支付,无法确认是否真正支付)");
InsureLog.builder().type(7).createTime(new Date()).requestType(2).requestPath(base_api_url + "/payStatus?policyId=" + policyId)
.returnCode("suc").returnMsg("用户已支付,等待更新保单状态").policyId(policyId).build().insert();
}
@PostMapping(value = "/payCallBack")
@ApiOperation(value = "9.投保支付收银台回调", httpMethod = "POST", notes = "支付完成跳转")
private Map payCallBack(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException {
log.info("支付回调");
Map map = Maps.newHashMap();
InputStream is = null;
is = request.getInputStream();
StringBuilder sb = new StringBuilder();
byte[] b = new byte[4096];
for (int n; (n = is.read(b)) != -1; ) {
sb.append(new String(b, 0, n));
}
String value = DigestUtils.md5Hex(appid + secret + timestamp + sb.toString());
if (!value.equals(sign)) {
return map;
}
Map paramsMap = Maps.newHashMap();
paramsMap.put("pid", pid);
paramsMap.put("timestamp", timestamp);
paramsMap.put("sign", sign);
PayCallBack callBack = JSONObject.parseObject(sb.toString(), PayCallBack.class);
InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getSerial_number()));
insurePay.setAmount(Double.valueOf(callBack.getAmount()));
insurePay.setPayStatus(Integer.parseInt(callBack.getPay_status()));
insurePay.setPaySerialNo(callBack.getPay_serial_no());
insurePay.setSerialNumber(callBack.getSerial_number());
insurePay.setPayType(callBack.getPay_type());
insurePay.updateById();
/*调用出单接口更新保单状态*/
Map bodyMap = Maps.newHashMap();
bodyMap.put("quotation_id", callBack.getSerial_number());
String data = HttpUtils.sendPost(getPolicyUrl, setParams(JSONObject.toJSONString(bodyMap), appid, secret), bodyMap);
Map dataMap = JSONObject.parseObject(data, Map.class);
if (dataMap.size() > 0) {
if ((dataMap.get("errcode").toString().equals("e25"))) {
//TODO 如果是E25则将保单设为出单中,更新交由保单出单回调做,设为出单状态是因为之后可以手动校验
InsurePolicy insurePolicy = InsurePolicy.builder().id(insurePay.getPolicyId()).build().selectById();
insurePolicy.setStatus("2");
insurePolicy.setUpdateTime(new Date());
insurePolicy.updateById();
}
InsureLog.builder().requestParam(JSONObject.toJSONString(setParams(JSONObject.toJSONString(bodyMap), appid, secret))).type(6)
.requestData(JSONObject.toJSONString(bodyMap)).createTime(new Date()).requestType(1).returnBody(data).requestPath(getPolicyUrl)
.returnCode(dataMap.get("errcode").toString()).returnMsg("请求出单中").build().insert();
map.put("status", "1");
}
InsureLog.builder().type(7).createTime(new Date()).requestType(1).requestPath(base_api_url + "/payCallBack")
.returnCode("suc").returnMsg("确认支付成功,支付方式:" + insurePay.getPayType() + ",支付金额:" + callBack.getAmount()).policyId(insurePay.getPolicyId()).build().insert();
map.put("status", "1");
return map;
}
@PostMapping(value = "/issueCallback")
@ApiOperation(value = "10.保单出单回调", httpMethod = "POST", notes = "支付完成跳转")
private Map issueCallback(HttpServletRequest request, @RequestParam String pid, @RequestParam String sign, @RequestParam String timestamp) throws IOException {
log.info("保单出单回调");
Map map = Maps.newHashMap();
map.put("status", "1");
InputStream is = null;
is = request.getInputStream();
StringBuilder sb = new StringBuilder();
byte[] b = new byte[4096];
for (int n; (n = is.read(b)) != -1; ) {
sb.append(new String(b, 0, n));
}
String value = DigestUtils.md5Hex(appid + secret + timestamp + sb.toString());
if (!value.equals(sign)) {
return map;
}
PolicyCallBack callBack = JSONObject.parseObject(sb.toString(), PolicyCallBack.class);
InsurePay insurePay = InsurePay.builder().build().selectOne(new QueryWrapper<InsurePay>().lambda().eq(InsurePay::getSerialNumber, callBack.getSerial_number()));
InsurePolicy insurePolicy = InsurePolicy.builder().id(insurePay.getPolicyId()).build().selectById();
List<InsureUser> userList = InsureUser.builder().build().selectList(new QueryWrapper<InsureUser>().lambda().eq(InsureUser::getPolicyId, insurePolicy.getId()));
insurePolicy.setUpdateTime(new Date());
if (callBack.getStatus().equals("1")) {
insurePay.setPayStatus(2);
insurePolicy.setPolicyNo(callBack.getPolicy_no());
insurePolicy.setTotalPremium(callBack.getTotal_premium());
insurePolicy.setPolicyFile(callBack.getPolicy_file());
insurePolicy.setStatus("1");
insurePolicy.setKitUrl(callBack.getKit_url());
userList.forEach(u -> {
u.setStatus("1");
u.setInsureStatus(1);
u.updateById();
});
} else {
insurePay.setPayStatus(3);
insurePolicy.setStatus("3");
userList.forEach(u -> {
u.setStatus("2");
u.setInsureStatus(2);
u.updateById();
});
insurePolicy.updateById();
insurePay.updateById();
}
return map;
}
} }
package cn.timer.api.controller.insure;
import cn.timer.api.bean.insure.InsurePay;
import cn.timer.api.bean.insure.InsurePolicy;
import cn.timer.api.dao.insure.InsureUserMapper;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 支付流水表
*
* @author wgd
* @email 862422848@qq.com
* @date 2022-05-18 19:33:23
*/
@RestController
@RequestMapping("/insurePay")
public class InsurePayController{
@Autowired
private InsureUserMapper insureUserMapper;
@Value("${insure.appid}")
private String appid;
@Value("${insure.secret}")
private String secret;
@Value("${insure.appidq}")
private String appidq;
@Value("${insure.secretq}")
private String secretq;
/*投保支付*/
@Value("${insure.toPayUrl}")
private String toPayUrl;
@GetMapping(value = "/cancelPayment")
@ApiOperation(value = "取消支付", httpMethod = "GET", notes = "取消支付")
public Result<Object> cancelPayment(@RequestParam(required = true,value = "policyId")Integer policyId){
InsurePolicy insurePolicy = InsurePolicy.builder().id(policyId).build().selectById();
if(insurePolicy==null){
return ResultUtil.error("保单不存在");
}
if("4".equals(insurePolicy.getStatus())){
return ResultUtil.error("保单不是未支付状态");
}
// String data = HttpUtils.sendGet(setParams())
return null;
};
}
package cn.timer.api.dao.insure;
import cn.timer.api.bean.insure.InsurePay;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* 支付流水表
*
* @author wgd
* @email 862422848@qq.com
* @date 2022-05-18 19:33:23
*/
@Repository
public interface InsurePayMapper extends BaseMapper<InsurePay> {
}
...@@ -38,6 +38,6 @@ public class InsureDto { ...@@ -38,6 +38,6 @@ public class InsureDto {
private String userName; private String userName;
private String idCardNo; private String idCardNo;
private String reason;/*批改原因*/ private String reason;/*批改原因*/
private Integer payType=1;/*支付方式 默认是在线支付*/
// private String // private String
} }
...@@ -40,5 +40,7 @@ public class PolicyDto { ...@@ -40,5 +40,7 @@ public class PolicyDto {
private String planId; private String planId;
private String categoryId; private String categoryId;
private String productId; private String productId;
private Integer policyPayType;
private Integer payId;
} }
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.insure.InsurePayMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="cn.timer.api.bean.insure.InsurePay" id="insurePayMap">
<result property="id" column="id"/>
<result property="payStatus" column="pay_status"/>
<result property="amount" column="amount"/>
<result property="payTime" column="pay_time"/>
<result property="endTime" column="end_time"/>
<result property="paySerialNo" column="pay_serial_no"/>
<result property="payType" column="pay_type"/>
<result property="policyId" column="policy_id"/>
<result property="serialNumber" column="serial_number"/>
</resultMap>
<select id="queryObject" resultType="cn.timer.api.bean.insure.InsurePay">
select *
from insure_pay
where id = #{value}
</select>
<select id="queryList" resultType="cn.timer.api.bean.insure.InsurePay">
select * from insure_pay
<where>
<if test="id != null and id != ''">AND `id` = #{id}</if>
<if test="payStatus != null and payStatus != ''">AND `pay_status` = #{payStatus}</if>
<if test="amount != null and amount != ''">AND `amount` = #{amount}</if>
<if test="payTime != null and payTime != ''">AND `pay_time` = #{payTime}</if>
<if test="endTime != null and endTime != ''">AND `end_time` = #{endTime}</if>
<if test="paySerialNo != null and paySerialNo != ''">AND `pay_serial_no` = #{paySerialNo}</if>
<if test="payType != null and payType != ''">AND `pay_type` = #{payType}</if>
</where>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from insure_pay
<where>
<if test="id != null and id != ''">AND `id` = #{id}</if>
<if test="payStatus != null and payStatus != ''">AND `pay_status` = #{payStatus}</if>
<if test="amount != null and amount != ''">AND `amount` = #{amount}</if>
<if test="payTime != null and payTime != ''">AND `pay_time` = #{payTime}</if>
<if test="endTime != null and endTime != ''">AND `end_time` = #{endTime}</if>
<if test="paySerialNo != null and paySerialNo != ''">AND `pay_serial_no` = #{paySerialNo}</if>
<if test="payType != null and payType != ''">AND `pay_type` = #{payType}</if>
</where>
</select>
<insert id="save" parameterType="cn.timer.api.bean.insure.InsurePay">
insert into insure_pay
(`id`,
`pay_status`,
`amount`,
`pay_time`,
`end_time`,
`pay_serial_no`,
`pay_type`)
values (#{id},
#{payStatus},
#{amount},
#{payTime},
#{endTime},
#{paySerialNo},
#{payType})
</insert>
<insert id="saveSelective" parameterType="cn.timer.api.bean.insure.InsurePay">
insert into insure_pay
(
<if test="id != null">`id`</if>
<if test="payStatus != null">,`pay_status`</if>
<if test="amount != null">,`amount`</if>
<if test="payTime != null">,`pay_time`</if>
<if test="endTime != null">,`end_time`</if>
<if test="paySerialNo != null">,`pay_serial_no`</if>
<if test="payType != null">,`pay_type`</if>
)
values
(
<if test="id != null">#{id}</if>
<if test="payStatus != null">,#{payStatus}</if>
<if test="amount != null">,#{amount}</if>
<if test="payTime != null">,#{payTime}</if>
<if test="endTime != null">,#{endTime}</if>
<if test="paySerialNo != null">,#{paySerialNo}</if>
<if test="payType != null">,#{payType}</if>
)
</insert>
<insert id="saveList" parameterType="cn.timer.api.bean.insure.InsurePay">
insert into insure_pay
(
`id`,
`pay_status`,
`amount`,
`pay_time`,
`end_time`,
`pay_serial_no`,
`pay_type`
)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.id},
#{item.payStatus},
#{item.amount},
#{item.payTime},
#{item.endTime},
#{item.paySerialNo},
#{item.payType}
)
</foreach>
</insert>
<update id="update" parameterType="cn.timer.api.bean.insure.InsurePay">
update insure_pay
<set>
<if test="payStatus != null">`pay_status` = #{payStatus},</if>
<if test="amount != null">`amount` = #{amount},</if>
<if test="payTime != null">`pay_time` = #{payTime},</if>
<if test="endTime != null">`end_time` = #{endTime},</if>
<if test="paySerialNo != null">`pay_serial_no` = #{paySerialNo},</if>
<if test="payType != null">`pay_type` = #{payType}</if>
</set>
where id = #{id}
</update>
<delete id="delete">
delete
from insure_pay
where id = #{value}
</delete>
<delete id="deleteBatch">
delete from insure_pay where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
<result property="orgCode" column="org_code"/> <result property="orgCode" column="org_code"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time"/>
<result property="policyPayType" column="policy_pay_type"/>
<result property="payId" column="pa_id"/>
</resultMap> </resultMap>
<select id="queryObject" resultType="cn.timer.api.bean.insure.InsurePolicy"> <select id="queryObject" resultType="cn.timer.api.bean.insure.InsurePolicy">
...@@ -244,7 +246,8 @@ ...@@ -244,7 +246,8 @@
sum(iu.price) AS totalPremium, sum(iu.price) AS totalPremium,
ip.update_time AS updateTime, ip.update_time AS updateTime,
ip.`status` as `status`, ip.`status` as `status`,
ip.org_code as orgCode ip.org_code as orgCode,
ip.pay_id as payId
FROM FROM
insure_policy ip insure_policy ip
LEFT JOIN insure_user iu ON iu.policy_id = ip.id LEFT JOIN insure_user iu ON iu.policy_id = ip.id
...@@ -303,7 +306,9 @@ ...@@ -303,7 +306,9 @@
ip.org_code as orgCode, ip.org_code as orgCode,
iu.insured_name as insuredName, iu.insured_name as insuredName,
iu.benefit_basic_plan as benefitBasicPlan, iu.benefit_basic_plan as benefitBasicPlan,
iu.benefit_occupation_category as benefitOccupationCategory iu.benefit_occupation_category as benefitOccupationCategory,
ip.policy_pay_type as policyPayType,
ip.product_id as productId
FROM FROM
insure_policy ip insure_policy ip
LEFT JOIN insure_user iu ON iu.policy_id = ip.id LEFT JOIN insure_user iu ON iu.policy_id = ip.id
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.core.db.dao.InsureProductMapper"> <mapper namespace="cn.timer.api.dao.insure.InsureProductMapper">
<!-- 可根据自己的需求,是否要使用 --> <!-- 可根据自己的需求,是否要使用 -->
<resultMap type="cn.timer.api.bean.insure.InsureProduct" id="insureProductMap"> <resultMap type="cn.timer.api.bean.insure.InsureProduct" id="insureProductMap">
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<result property="type" column="type"/> <result property="type" column="type"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="isDel" column="is_del"/> <result property="isDel" column="is_del"/>
<result property="payType" column="pay_type"/>
</resultMap> </resultMap>
<select id="queryObject" resultType="cn.timer.api.bean.insure.InsureProduct"> <select id="queryObject" resultType="cn.timer.api.bean.insure.InsureProduct">
......
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