提交充值接口修改

dev-discount
袁野 4 years ago
parent f11f249f80
commit 5bed33e4c1
  1. 92
      hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java
  2. 2
      hai-cweb/src/main/java/com/cweb/controller/pay/WechatPayController.java
  3. 160
      hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapper.java
  4. 7
      hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java
  5. 444
      hai-service/src/main/java/com/hai/dao/OutRechargeOrderSqlProvider.java
  6. 366
      hai-service/src/main/java/com/hai/entity/OutRechargeOrder.java
  7. 1503
      hai-service/src/main/java/com/hai/entity/OutRechargeOrderExample.java
  8. 55
      hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java
  9. 50
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java

@ -0,0 +1,92 @@
package com.cweb.controller;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighOrder;
import com.hai.entity.OutRechargeOrder;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.service.OutRechargeOrderService;
import com.hai.service.TelApiService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
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.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@Controller
@RequestMapping(value = "/outRechargeOrder")
@Api(value = "充值订单接口")
public class OutRechargeOrderController {
private static Logger log = LoggerFactory.getLogger(HighMerchantStoreController.class);
@Autowired
private UserCenter userCenter;
@Resource
private OutRechargeOrderService outRechargeOrderService;
@Resource
private TelApiService telApiService;
@RequestMapping(value="/ ",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "增加订单")
public ResponseData addOrder(@RequestBody OutRechargeOrder outRechargeOrder, HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
if (StringUtils.isBlank(outRechargeOrder.getRechargeContent()) ||
outRechargeOrder.getPayPrice() == null ||
outRechargeOrder.getOrderPrice() == null
) {
log.error("orderToPay error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 支付类型 1.微信支付
outRechargeOrder.setPayType(1);
// 判断充值模式:1 话费充值 2. 中石化 3. 中石油
if (outRechargeOrder.getRechargeModel() == 1) {
JSONObject telObject = telApiService.outApiTel(outRechargeOrder.getRechargeContent());
JSONObject o = telObject.getObject("result",JSONObject.class);
// 拼接内容
String remarks = o.get("province").toString() + o.get("company").toString();
outRechargeOrder.setRemarks(remarks);
} else if (outRechargeOrder.getRechargeModel() == 2) {
// 中石油需要姓名和身份证号
if (StringUtils.isBlank(outRechargeOrder.getRechargeName()) ||
StringUtils.isBlank(outRechargeOrder.getIdCard())
) {
log.error("orderToPay error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
}
return null;
} catch (Exception e) {
log.error("HighOrderController -> addOrder() error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -185,7 +185,7 @@ public class WechatPayController {
public ResponseData addLedgerReceiver(@RequestParam(value = "tel", required = true) String tel) {
try {
JSONObject jsonObject = telApiService.outApiTel(tel);
return ResponseMsgUtil.success(jsonObject);
return ResponseMsgUtil.success(jsonObject.get("result"));
} catch (Exception e) {
log.error("WechatPayController --> wechatNotify() error!", e);
return ResponseMsgUtil.exception(e);

@ -0,0 +1,160 @@
package com.hai.dao;
import com.hai.entity.OutRechargeOrder;
import com.hai.entity.OutRechargeOrderExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;
/**
*
* 代码由工具生成,请勿修改!!!
* 如果需要扩展请在其父类进行扩展
*
**/
@Repository
public interface OutRechargeOrderMapper extends OutRechargeOrderMapperExt {
@SelectProvider(type=OutRechargeOrderSqlProvider.class, method="countByExample")
long countByExample(OutRechargeOrderExample example);
@DeleteProvider(type=OutRechargeOrderSqlProvider.class, method="deleteByExample")
int deleteByExample(OutRechargeOrderExample example);
@Delete({
"delete from out_recharge_order",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into out_recharge_order (order_no, user_id, ",
"user_name, user_phone, ",
"recharge_model, pay_type, ",
"pay_price, order_price, ",
"pay_real_price, pay_serial_no, ",
"`status`, recharge_content, ",
"recharge_name, id_card, ",
"create_timed, pay_time, ",
"cancel_time, finish_time, ",
"remarks)",
"values (#{orderNo,jdbcType=VARCHAR}, #{userId,jdbcType=BIGINT}, ",
"#{userName,jdbcType=VARCHAR}, #{userPhone,jdbcType=VARCHAR}, ",
"#{rechargeModel,jdbcType=INTEGER}, #{payType,jdbcType=INTEGER}, ",
"#{payPrice,jdbcType=DECIMAL}, #{orderPrice,jdbcType=DECIMAL}, ",
"#{payRealPrice,jdbcType=DECIMAL}, #{paySerialNo,jdbcType=VARCHAR}, ",
"#{status,jdbcType=INTEGER}, #{rechargeContent,jdbcType=VARCHAR}, ",
"#{rechargeName,jdbcType=VARCHAR}, #{idCard,jdbcType=VARCHAR}, ",
"#{createTimed,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, ",
"#{cancelTime,jdbcType=TIMESTAMP}, #{finishTime,jdbcType=TIMESTAMP}, ",
"#{remarks,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(OutRechargeOrder record);
@InsertProvider(type=OutRechargeOrderSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(OutRechargeOrder record);
@SelectProvider(type=OutRechargeOrderSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
@Result(column="user_name", property="userName", jdbcType=JdbcType.VARCHAR),
@Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="recharge_model", property="rechargeModel", jdbcType=JdbcType.INTEGER),
@Result(column="pay_type", property="payType", jdbcType=JdbcType.INTEGER),
@Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="order_price", property="orderPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="pay_real_price", property="payRealPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="recharge_content", property="rechargeContent", jdbcType=JdbcType.VARCHAR),
@Result(column="recharge_name", property="rechargeName", jdbcType=JdbcType.VARCHAR),
@Result(column="id_card", property="idCard", jdbcType=JdbcType.VARCHAR),
@Result(column="create_timed", property="createTimed", jdbcType=JdbcType.TIMESTAMP),
@Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="finish_time", property="finishTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="remarks", property="remarks", jdbcType=JdbcType.VARCHAR)
})
List<OutRechargeOrder> selectByExample(OutRechargeOrderExample example);
@Select({
"select",
"id, order_no, user_id, user_name, user_phone, recharge_model, pay_type, pay_price, ",
"order_price, pay_real_price, pay_serial_no, `status`, recharge_content, recharge_name, ",
"id_card, create_timed, pay_time, cancel_time, finish_time, remarks",
"from out_recharge_order",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
@Result(column="user_name", property="userName", jdbcType=JdbcType.VARCHAR),
@Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="recharge_model", property="rechargeModel", jdbcType=JdbcType.INTEGER),
@Result(column="pay_type", property="payType", jdbcType=JdbcType.INTEGER),
@Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="order_price", property="orderPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="pay_real_price", property="payRealPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="recharge_content", property="rechargeContent", jdbcType=JdbcType.VARCHAR),
@Result(column="recharge_name", property="rechargeName", jdbcType=JdbcType.VARCHAR),
@Result(column="id_card", property="idCard", jdbcType=JdbcType.VARCHAR),
@Result(column="create_timed", property="createTimed", jdbcType=JdbcType.TIMESTAMP),
@Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="finish_time", property="finishTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="remarks", property="remarks", jdbcType=JdbcType.VARCHAR)
})
OutRechargeOrder selectByPrimaryKey(Long id);
@UpdateProvider(type=OutRechargeOrderSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") OutRechargeOrder record, @Param("example") OutRechargeOrderExample example);
@UpdateProvider(type=OutRechargeOrderSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") OutRechargeOrder record, @Param("example") OutRechargeOrderExample example);
@UpdateProvider(type=OutRechargeOrderSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(OutRechargeOrder record);
@Update({
"update out_recharge_order",
"set order_no = #{orderNo,jdbcType=VARCHAR},",
"user_id = #{userId,jdbcType=BIGINT},",
"user_name = #{userName,jdbcType=VARCHAR},",
"user_phone = #{userPhone,jdbcType=VARCHAR},",
"recharge_model = #{rechargeModel,jdbcType=INTEGER},",
"pay_type = #{payType,jdbcType=INTEGER},",
"pay_price = #{payPrice,jdbcType=DECIMAL},",
"order_price = #{orderPrice,jdbcType=DECIMAL},",
"pay_real_price = #{payRealPrice,jdbcType=DECIMAL},",
"pay_serial_no = #{paySerialNo,jdbcType=VARCHAR},",
"`status` = #{status,jdbcType=INTEGER},",
"recharge_content = #{rechargeContent,jdbcType=VARCHAR},",
"recharge_name = #{rechargeName,jdbcType=VARCHAR},",
"id_card = #{idCard,jdbcType=VARCHAR},",
"create_timed = #{createTimed,jdbcType=TIMESTAMP},",
"pay_time = #{payTime,jdbcType=TIMESTAMP},",
"cancel_time = #{cancelTime,jdbcType=TIMESTAMP},",
"finish_time = #{finishTime,jdbcType=TIMESTAMP},",
"remarks = #{remarks,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(OutRechargeOrder record);
}

@ -0,0 +1,7 @@
package com.hai.dao;
/**
* mapper扩展类
*/
public interface OutRechargeOrderMapperExt {
}

@ -0,0 +1,444 @@
package com.hai.dao;
import com.hai.entity.OutRechargeOrder;
import com.hai.entity.OutRechargeOrderExample.Criteria;
import com.hai.entity.OutRechargeOrderExample.Criterion;
import com.hai.entity.OutRechargeOrderExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class OutRechargeOrderSqlProvider {
public String countByExample(OutRechargeOrderExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("out_recharge_order");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(OutRechargeOrderExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("out_recharge_order");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(OutRechargeOrder record) {
SQL sql = new SQL();
sql.INSERT_INTO("out_recharge_order");
if (record.getOrderNo() != null) {
sql.VALUES("order_no", "#{orderNo,jdbcType=VARCHAR}");
}
if (record.getUserId() != null) {
sql.VALUES("user_id", "#{userId,jdbcType=BIGINT}");
}
if (record.getUserName() != null) {
sql.VALUES("user_name", "#{userName,jdbcType=VARCHAR}");
}
if (record.getUserPhone() != null) {
sql.VALUES("user_phone", "#{userPhone,jdbcType=VARCHAR}");
}
if (record.getRechargeModel() != null) {
sql.VALUES("recharge_model", "#{rechargeModel,jdbcType=INTEGER}");
}
if (record.getPayType() != null) {
sql.VALUES("pay_type", "#{payType,jdbcType=INTEGER}");
}
if (record.getPayPrice() != null) {
sql.VALUES("pay_price", "#{payPrice,jdbcType=DECIMAL}");
}
if (record.getOrderPrice() != null) {
sql.VALUES("order_price", "#{orderPrice,jdbcType=DECIMAL}");
}
if (record.getPayRealPrice() != null) {
sql.VALUES("pay_real_price", "#{payRealPrice,jdbcType=DECIMAL}");
}
if (record.getPaySerialNo() != null) {
sql.VALUES("pay_serial_no", "#{paySerialNo,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
if (record.getRechargeContent() != null) {
sql.VALUES("recharge_content", "#{rechargeContent,jdbcType=VARCHAR}");
}
if (record.getRechargeName() != null) {
sql.VALUES("recharge_name", "#{rechargeName,jdbcType=VARCHAR}");
}
if (record.getIdCard() != null) {
sql.VALUES("id_card", "#{idCard,jdbcType=VARCHAR}");
}
if (record.getCreateTimed() != null) {
sql.VALUES("create_timed", "#{createTimed,jdbcType=TIMESTAMP}");
}
if (record.getPayTime() != null) {
sql.VALUES("pay_time", "#{payTime,jdbcType=TIMESTAMP}");
}
if (record.getCancelTime() != null) {
sql.VALUES("cancel_time", "#{cancelTime,jdbcType=TIMESTAMP}");
}
if (record.getFinishTime() != null) {
sql.VALUES("finish_time", "#{finishTime,jdbcType=TIMESTAMP}");
}
if (record.getRemarks() != null) {
sql.VALUES("remarks", "#{remarks,jdbcType=VARCHAR}");
}
return sql.toString();
}
public String selectByExample(OutRechargeOrderExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("order_no");
sql.SELECT("user_id");
sql.SELECT("user_name");
sql.SELECT("user_phone");
sql.SELECT("recharge_model");
sql.SELECT("pay_type");
sql.SELECT("pay_price");
sql.SELECT("order_price");
sql.SELECT("pay_real_price");
sql.SELECT("pay_serial_no");
sql.SELECT("`status`");
sql.SELECT("recharge_content");
sql.SELECT("recharge_name");
sql.SELECT("id_card");
sql.SELECT("create_timed");
sql.SELECT("pay_time");
sql.SELECT("cancel_time");
sql.SELECT("finish_time");
sql.SELECT("remarks");
sql.FROM("out_recharge_order");
applyWhere(sql, example, false);
if (example != null && example.getOrderByClause() != null) {
sql.ORDER_BY(example.getOrderByClause());
}
return sql.toString();
}
public String updateByExampleSelective(Map<String, Object> parameter) {
OutRechargeOrder record = (OutRechargeOrder) parameter.get("record");
OutRechargeOrderExample example = (OutRechargeOrderExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("out_recharge_order");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getOrderNo() != null) {
sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}");
}
if (record.getUserId() != null) {
sql.SET("user_id = #{record.userId,jdbcType=BIGINT}");
}
if (record.getUserName() != null) {
sql.SET("user_name = #{record.userName,jdbcType=VARCHAR}");
}
if (record.getUserPhone() != null) {
sql.SET("user_phone = #{record.userPhone,jdbcType=VARCHAR}");
}
if (record.getRechargeModel() != null) {
sql.SET("recharge_model = #{record.rechargeModel,jdbcType=INTEGER}");
}
if (record.getPayType() != null) {
sql.SET("pay_type = #{record.payType,jdbcType=INTEGER}");
}
if (record.getPayPrice() != null) {
sql.SET("pay_price = #{record.payPrice,jdbcType=DECIMAL}");
}
if (record.getOrderPrice() != null) {
sql.SET("order_price = #{record.orderPrice,jdbcType=DECIMAL}");
}
if (record.getPayRealPrice() != null) {
sql.SET("pay_real_price = #{record.payRealPrice,jdbcType=DECIMAL}");
}
if (record.getPaySerialNo() != null) {
sql.SET("pay_serial_no = #{record.paySerialNo,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
if (record.getRechargeContent() != null) {
sql.SET("recharge_content = #{record.rechargeContent,jdbcType=VARCHAR}");
}
if (record.getRechargeName() != null) {
sql.SET("recharge_name = #{record.rechargeName,jdbcType=VARCHAR}");
}
if (record.getIdCard() != null) {
sql.SET("id_card = #{record.idCard,jdbcType=VARCHAR}");
}
if (record.getCreateTimed() != null) {
sql.SET("create_timed = #{record.createTimed,jdbcType=TIMESTAMP}");
}
if (record.getPayTime() != null) {
sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}");
}
if (record.getCancelTime() != null) {
sql.SET("cancel_time = #{record.cancelTime,jdbcType=TIMESTAMP}");
}
if (record.getFinishTime() != null) {
sql.SET("finish_time = #{record.finishTime,jdbcType=TIMESTAMP}");
}
if (record.getRemarks() != null) {
sql.SET("remarks = #{record.remarks,jdbcType=VARCHAR}");
}
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByExample(Map<String, Object> parameter) {
SQL sql = new SQL();
sql.UPDATE("out_recharge_order");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}");
sql.SET("user_id = #{record.userId,jdbcType=BIGINT}");
sql.SET("user_name = #{record.userName,jdbcType=VARCHAR}");
sql.SET("user_phone = #{record.userPhone,jdbcType=VARCHAR}");
sql.SET("recharge_model = #{record.rechargeModel,jdbcType=INTEGER}");
sql.SET("pay_type = #{record.payType,jdbcType=INTEGER}");
sql.SET("pay_price = #{record.payPrice,jdbcType=DECIMAL}");
sql.SET("order_price = #{record.orderPrice,jdbcType=DECIMAL}");
sql.SET("pay_real_price = #{record.payRealPrice,jdbcType=DECIMAL}");
sql.SET("pay_serial_no = #{record.paySerialNo,jdbcType=VARCHAR}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("recharge_content = #{record.rechargeContent,jdbcType=VARCHAR}");
sql.SET("recharge_name = #{record.rechargeName,jdbcType=VARCHAR}");
sql.SET("id_card = #{record.idCard,jdbcType=VARCHAR}");
sql.SET("create_timed = #{record.createTimed,jdbcType=TIMESTAMP}");
sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}");
sql.SET("cancel_time = #{record.cancelTime,jdbcType=TIMESTAMP}");
sql.SET("finish_time = #{record.finishTime,jdbcType=TIMESTAMP}");
sql.SET("remarks = #{record.remarks,jdbcType=VARCHAR}");
OutRechargeOrderExample example = (OutRechargeOrderExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(OutRechargeOrder record) {
SQL sql = new SQL();
sql.UPDATE("out_recharge_order");
if (record.getOrderNo() != null) {
sql.SET("order_no = #{orderNo,jdbcType=VARCHAR}");
}
if (record.getUserId() != null) {
sql.SET("user_id = #{userId,jdbcType=BIGINT}");
}
if (record.getUserName() != null) {
sql.SET("user_name = #{userName,jdbcType=VARCHAR}");
}
if (record.getUserPhone() != null) {
sql.SET("user_phone = #{userPhone,jdbcType=VARCHAR}");
}
if (record.getRechargeModel() != null) {
sql.SET("recharge_model = #{rechargeModel,jdbcType=INTEGER}");
}
if (record.getPayType() != null) {
sql.SET("pay_type = #{payType,jdbcType=INTEGER}");
}
if (record.getPayPrice() != null) {
sql.SET("pay_price = #{payPrice,jdbcType=DECIMAL}");
}
if (record.getOrderPrice() != null) {
sql.SET("order_price = #{orderPrice,jdbcType=DECIMAL}");
}
if (record.getPayRealPrice() != null) {
sql.SET("pay_real_price = #{payRealPrice,jdbcType=DECIMAL}");
}
if (record.getPaySerialNo() != null) {
sql.SET("pay_serial_no = #{paySerialNo,jdbcType=VARCHAR}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
if (record.getRechargeContent() != null) {
sql.SET("recharge_content = #{rechargeContent,jdbcType=VARCHAR}");
}
if (record.getRechargeName() != null) {
sql.SET("recharge_name = #{rechargeName,jdbcType=VARCHAR}");
}
if (record.getIdCard() != null) {
sql.SET("id_card = #{idCard,jdbcType=VARCHAR}");
}
if (record.getCreateTimed() != null) {
sql.SET("create_timed = #{createTimed,jdbcType=TIMESTAMP}");
}
if (record.getPayTime() != null) {
sql.SET("pay_time = #{payTime,jdbcType=TIMESTAMP}");
}
if (record.getCancelTime() != null) {
sql.SET("cancel_time = #{cancelTime,jdbcType=TIMESTAMP}");
}
if (record.getFinishTime() != null) {
sql.SET("finish_time = #{finishTime,jdbcType=TIMESTAMP}");
}
if (record.getRemarks() != null) {
sql.SET("remarks = #{remarks,jdbcType=VARCHAR}");
}
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();
}
protected void applyWhere(SQL sql, OutRechargeOrderExample example, boolean includeExamplePhrase) {
if (example == null) {
return;
}
String parmPhrase1;
String parmPhrase1_th;
String parmPhrase2;
String parmPhrase2_th;
String parmPhrase3;
String parmPhrase3_th;
if (includeExamplePhrase) {
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
} else {
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
}
StringBuilder sb = new StringBuilder();
List<Criteria> oredCriteria = example.getOredCriteria();
boolean firstCriteria = true;
for (int i = 0; i < oredCriteria.size(); i++) {
Criteria criteria = oredCriteria.get(i);
if (criteria.isValid()) {
if (firstCriteria) {
firstCriteria = false;
} else {
sb.append(" or ");
}
sb.append('(');
List<Criterion> criterions = criteria.getAllCriteria();
boolean firstCriterion = true;
for (int j = 0; j < criterions.size(); j++) {
Criterion criterion = criterions.get(j);
if (firstCriterion) {
firstCriterion = false;
} else {
sb.append(" and ");
}
if (criterion.isNoValue()) {
sb.append(criterion.getCondition());
} else if (criterion.isSingleValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
} else {
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler()));
}
} else if (criterion.isBetweenValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
} else {
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isListValue()) {
sb.append(criterion.getCondition());
sb.append(" (");
List<?> listItems = (List<?>) criterion.getValue();
boolean comma = false;
for (int k = 0; k < listItems.size(); k++) {
if (comma) {
sb.append(", ");
} else {
comma = true;
}
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase3, i, j, k));
} else {
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
}
}
sb.append(')');
}
}
sb.append(')');
}
}
if (sb.length() > 0) {
sql.WHERE(sb.toString());
}
}
}

@ -0,0 +1,366 @@
package com.hai.entity;
import java.io.Serializable;
import java.util.Date;
/**
* out_recharge_order
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class OutRechargeOrder implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 订单流水号
*/
private String orderNo;
/**
* 用户表ID
*/
private Long userId;
/**
* 用户名称
*/
private String userName;
/**
* 用户电话
*/
private String userPhone;
/**
* 充值模式1 话费充值 2. 中石化 3. 中石油
*/
private Integer rechargeModel;
/**
* 1.微信
*/
private Integer payType;
/**
* 支付金额
*/
private Long payPrice;
/**
* 订单充值金额
*/
private Long orderPrice;
/**
* 实际金额
*/
private Long payRealPrice;
/**
* 支付流水号
*/
private String paySerialNo;
/**
* 订单状态 1.待支付 2.已支付 3.已完成 4.已退款 5.已取消
*/
private Integer status;
/**
* 充值内容电话号码 卡号
*/
private String rechargeContent;
/**
* 中石油需要的持卡人姓名
*/
private String rechargeName;
/**
* 中石油需要持卡人身份证
*/
private String idCard;
/**
* 生成时间
*/
private Date createTimed;
/**
* 支付时间
*/
private Date payTime;
/**
* 取消时间
*/
private Date cancelTime;
/**
* 完成时间
*/
private Date finishTime;
private String remarks;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserPhone() {
return userPhone;
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
}
public Integer getRechargeModel() {
return rechargeModel;
}
public void setRechargeModel(Integer rechargeModel) {
this.rechargeModel = rechargeModel;
}
public Integer getPayType() {
return payType;
}
public void setPayType(Integer payType) {
this.payType = payType;
}
public Long getPayPrice() {
return payPrice;
}
public void setPayPrice(Long payPrice) {
this.payPrice = payPrice;
}
public Long getOrderPrice() {
return orderPrice;
}
public void setOrderPrice(Long orderPrice) {
this.orderPrice = orderPrice;
}
public Long getPayRealPrice() {
return payRealPrice;
}
public void setPayRealPrice(Long payRealPrice) {
this.payRealPrice = payRealPrice;
}
public String getPaySerialNo() {
return paySerialNo;
}
public void setPaySerialNo(String paySerialNo) {
this.paySerialNo = paySerialNo;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getRechargeContent() {
return rechargeContent;
}
public void setRechargeContent(String rechargeContent) {
this.rechargeContent = rechargeContent;
}
public String getRechargeName() {
return rechargeName;
}
public void setRechargeName(String rechargeName) {
this.rechargeName = rechargeName;
}
public String getIdCard() {
return idCard;
}
public void setIdCard(String idCard) {
this.idCard = idCard;
}
public Date getCreateTimed() {
return createTimed;
}
public void setCreateTimed(Date createTimed) {
this.createTimed = createTimed;
}
public Date getPayTime() {
return payTime;
}
public void setPayTime(Date payTime) {
this.payTime = payTime;
}
public Date getCancelTime() {
return cancelTime;
}
public void setCancelTime(Date cancelTime) {
this.cancelTime = cancelTime;
}
public Date getFinishTime() {
return finishTime;
}
public void setFinishTime(Date finishTime) {
this.finishTime = finishTime;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
OutRechargeOrder other = (OutRechargeOrder) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getOrderNo() == null ? other.getOrderNo() == null : this.getOrderNo().equals(other.getOrderNo()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getUserName() == null ? other.getUserName() == null : this.getUserName().equals(other.getUserName()))
&& (this.getUserPhone() == null ? other.getUserPhone() == null : this.getUserPhone().equals(other.getUserPhone()))
&& (this.getRechargeModel() == null ? other.getRechargeModel() == null : this.getRechargeModel().equals(other.getRechargeModel()))
&& (this.getPayType() == null ? other.getPayType() == null : this.getPayType().equals(other.getPayType()))
&& (this.getPayPrice() == null ? other.getPayPrice() == null : this.getPayPrice().equals(other.getPayPrice()))
&& (this.getOrderPrice() == null ? other.getOrderPrice() == null : this.getOrderPrice().equals(other.getOrderPrice()))
&& (this.getPayRealPrice() == null ? other.getPayRealPrice() == null : this.getPayRealPrice().equals(other.getPayRealPrice()))
&& (this.getPaySerialNo() == null ? other.getPaySerialNo() == null : this.getPaySerialNo().equals(other.getPaySerialNo()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getRechargeContent() == null ? other.getRechargeContent() == null : this.getRechargeContent().equals(other.getRechargeContent()))
&& (this.getRechargeName() == null ? other.getRechargeName() == null : this.getRechargeName().equals(other.getRechargeName()))
&& (this.getIdCard() == null ? other.getIdCard() == null : this.getIdCard().equals(other.getIdCard()))
&& (this.getCreateTimed() == null ? other.getCreateTimed() == null : this.getCreateTimed().equals(other.getCreateTimed()))
&& (this.getPayTime() == null ? other.getPayTime() == null : this.getPayTime().equals(other.getPayTime()))
&& (this.getCancelTime() == null ? other.getCancelTime() == null : this.getCancelTime().equals(other.getCancelTime()))
&& (this.getFinishTime() == null ? other.getFinishTime() == null : this.getFinishTime().equals(other.getFinishTime()))
&& (this.getRemarks() == null ? other.getRemarks() == null : this.getRemarks().equals(other.getRemarks()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getOrderNo() == null) ? 0 : getOrderNo().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getUserName() == null) ? 0 : getUserName().hashCode());
result = prime * result + ((getUserPhone() == null) ? 0 : getUserPhone().hashCode());
result = prime * result + ((getRechargeModel() == null) ? 0 : getRechargeModel().hashCode());
result = prime * result + ((getPayType() == null) ? 0 : getPayType().hashCode());
result = prime * result + ((getPayPrice() == null) ? 0 : getPayPrice().hashCode());
result = prime * result + ((getOrderPrice() == null) ? 0 : getOrderPrice().hashCode());
result = prime * result + ((getPayRealPrice() == null) ? 0 : getPayRealPrice().hashCode());
result = prime * result + ((getPaySerialNo() == null) ? 0 : getPaySerialNo().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getRechargeContent() == null) ? 0 : getRechargeContent().hashCode());
result = prime * result + ((getRechargeName() == null) ? 0 : getRechargeName().hashCode());
result = prime * result + ((getIdCard() == null) ? 0 : getIdCard().hashCode());
result = prime * result + ((getCreateTimed() == null) ? 0 : getCreateTimed().hashCode());
result = prime * result + ((getPayTime() == null) ? 0 : getPayTime().hashCode());
result = prime * result + ((getCancelTime() == null) ? 0 : getCancelTime().hashCode());
result = prime * result + ((getFinishTime() == null) ? 0 : getFinishTime().hashCode());
result = prime * result + ((getRemarks() == null) ? 0 : getRemarks().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", orderNo=").append(orderNo);
sb.append(", userId=").append(userId);
sb.append(", userName=").append(userName);
sb.append(", userPhone=").append(userPhone);
sb.append(", rechargeModel=").append(rechargeModel);
sb.append(", payType=").append(payType);
sb.append(", payPrice=").append(payPrice);
sb.append(", orderPrice=").append(orderPrice);
sb.append(", payRealPrice=").append(payRealPrice);
sb.append(", paySerialNo=").append(paySerialNo);
sb.append(", status=").append(status);
sb.append(", rechargeContent=").append(rechargeContent);
sb.append(", rechargeName=").append(rechargeName);
sb.append(", idCard=").append(idCard);
sb.append(", createTimed=").append(createTimed);
sb.append(", payTime=").append(payTime);
sb.append(", cancelTime=").append(cancelTime);
sb.append(", finishTime=").append(finishTime);
sb.append(", remarks=").append(remarks);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

@ -0,0 +1,55 @@
package com.hai.service;
import com.hai.entity.OutRechargeOrder;
import java.util.List;
import java.util.Map;
public interface OutRechargeOrderService {
/**
* @Author Sum1Dream
* @Description // 查询充值订单
* @Date 15:18 2021/6/11
* @Param [map]
* @return java.util.List<com.hai.entity.OutRechargeOrder>
**/
List<OutRechargeOrder> getListRechargeOrder(Map<String , String> map);
/**
* @Author Sum1Dream
* @Description // 根据订单ID查询订单
* @Date 15:19 2021/6/11
* @Param [orderId]
* @return com.hai.entity.OutRechargeOrder
**/
OutRechargeOrder findByOrderId(Long orderId);
/**
* @Author Sum1Dream
* @Description // 根据订单号查询订单
* @Date 15:20 2021/6/11
* @Param [orderNo]
* @return com.hai.entity.OutRechargeOrder
**/
OutRechargeOrder findByOrderNo(String orderNo);
/***
* @Author Sum1Dream
* @Description // 新增订单
* @Date 15:25 2021/6/11
* @Param [outRechargeOrder]
* @return void
**/
void insertOrder(OutRechargeOrder outRechargeOrder);
/***
* @Author Sum1Dream
* @Description // 修改订单
* @Date 15:26 2021/6/11
* @Param [outRechargeOrder]
* @return void
**/
void updateOrder(OutRechargeOrder outRechargeOrder);
}

@ -0,0 +1,50 @@
package com.hai.service.impl;
import com.hai.dao.OutRechargeOrderMapper;
import com.hai.entity.OutRechargeOrder;
import com.hai.entity.OutRechargeOrderExample;
import com.hai.service.OutRechargeOrderService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service("outRechargeOrderService")
public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
@Resource
private OutRechargeOrderMapper outRechargeOrderMapper;
@Override
public List<OutRechargeOrder> getListRechargeOrder(Map<String, String> map) {
return null;
}
@Override
public OutRechargeOrder findByOrderId(Long orderId) {
return outRechargeOrderMapper.selectByPrimaryKey(orderId);
}
@Override
public OutRechargeOrder findByOrderNo(String orderNo) {
OutRechargeOrderExample example = new OutRechargeOrderExample();
example.createCriteria().andOrderNoEqualTo(orderNo);
return outRechargeOrderMapper.selectByExample(example).get(0);
}
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void insertOrder(OutRechargeOrder outRechargeOrder) {
outRechargeOrderMapper.insert(outRechargeOrder);
}
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void updateOrder(OutRechargeOrder outRechargeOrder) {
outRechargeOrderMapper.updateByPrimaryKey(outRechargeOrder);
}
}
Loading…
Cancel
Save