master
commit
ba56d995a2
Binary file not shown.
@ -0,0 +1,106 @@ |
||||
package com.bweb.controller.file; |
||||
|
||||
import com.bweb.controller.cms.CmsContentController; |
||||
import com.github.pagehelper.PageHelper; |
||||
import com.github.pagehelper.PageInfo; |
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import com.hfkj.common.security.SessionObject; |
||||
import com.hfkj.common.security.UserCenter; |
||||
import com.hfkj.common.utils.ResponseMsgUtil; |
||||
import com.hfkj.entity.FileRecords; |
||||
import com.hfkj.model.ResponseData; |
||||
import com.hfkj.model.SecUserSessionObject; |
||||
import com.hfkj.service.file.FileRecordsService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestMethod; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.util.Date; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
@Controller |
||||
@RequestMapping(value="/file") |
||||
@Api(value="文件操作") |
||||
public class FileController { |
||||
|
||||
Logger log = LoggerFactory.getLogger(CmsContentController.class); |
||||
|
||||
@Resource |
||||
private FileRecordsService fileRecordsService; |
||||
|
||||
@Resource |
||||
private UserCenter userCenter; |
||||
|
||||
|
||||
@RequestMapping(value="/getFileRecordsList",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询列表") |
||||
public ResponseData getFileRecordsList( HttpServletRequest request) { |
||||
try { |
||||
|
||||
SessionObject sessionObject = userCenter.getSessionObject(request); |
||||
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject(); |
||||
|
||||
Map<String, Object> map = new HashMap<>(); |
||||
map.put("opId", userModel.getAccount().getId()); |
||||
return ResponseMsgUtil.success(fileRecordsService.getList(map)); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/findFileRecords",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询详情") |
||||
public ResponseData findFileRecords( |
||||
@RequestParam(value = "id" , required = true) Long id) { |
||||
try { |
||||
|
||||
return ResponseMsgUtil.success(fileRecordsService.queryDetail(id)); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/getDownLoad",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "下载") |
||||
public ResponseData getDownLoad( |
||||
@RequestParam(value = "id" , required = true) Long id) { |
||||
try { |
||||
|
||||
FileRecords fileRecords = fileRecordsService.queryDetail(id); |
||||
if (fileRecords.getStatus() != 1) { |
||||
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前状态错误!"); |
||||
} |
||||
|
||||
fileRecords.setStatus(1); |
||||
fileRecords.setUpdateTime(new Date()); |
||||
fileRecords.setDownloadStatus(1); |
||||
fileRecords.setDownloadTime(new Date()); |
||||
fileRecordsService.update(fileRecords); |
||||
|
||||
return ResponseMsgUtil.success(fileRecords.getFileUrl()); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,11 @@ |
||||
package com.order.controller.business; |
||||
|
||||
import io.swagger.annotations.Api; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
||||
@Controller |
||||
@RequestMapping(value="/orderDownload") |
||||
@Api(value="订单下载管理") |
||||
public class BsOrderDownloadController { |
||||
} |
@ -0,0 +1,120 @@ |
||||
package com.order.utils.excel; |
||||
|
||||
import com.alibaba.excel.metadata.CellData; |
||||
import com.alibaba.excel.metadata.Head; |
||||
import com.alibaba.excel.write.handler.CellWriteHandler; |
||||
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; |
||||
import com.alibaba.excel.write.metadata.holder.WriteTableHolder; |
||||
import org.apache.poi.ss.usermodel.Cell; |
||||
import org.apache.poi.ss.usermodel.CellType; |
||||
import org.apache.poi.ss.usermodel.Row; |
||||
import org.apache.poi.ss.usermodel.Sheet; |
||||
import org.apache.poi.ss.util.CellRangeAddress; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @className: ExcelMergeHandler |
||||
* @author: HuRui |
||||
* @date: 2024/8/17 |
||||
**/ |
||||
public class OrderCouponExcelMergeHandler implements CellWriteHandler { |
||||
|
||||
private int[] mergeColumnIndex; |
||||
private int mergeRowIndex; |
||||
|
||||
public OrderCouponExcelMergeHandler() { |
||||
} |
||||
|
||||
/** |
||||
* 构造函数 |
||||
* |
||||
* @param mergeRowIndex 合并开始的行索引 |
||||
* @param mergeColumnIndex 要合并的列索引数组 |
||||
*/ |
||||
public OrderCouponExcelMergeHandler(int mergeRowIndex, int[] mergeColumnIndex) { |
||||
this.mergeRowIndex = mergeRowIndex; |
||||
this.mergeColumnIndex = mergeColumnIndex; |
||||
} |
||||
|
||||
@Override |
||||
public void beforeCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Head head, Integer integer, Integer integer1, Boolean aBoolean) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void afterCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Cell cell, Head head, Integer integer, Boolean aBoolean) { |
||||
|
||||
} |
||||
|
||||
|
||||
/** |
||||
* 当前单元格向上合并 |
||||
* |
||||
* @param writeSheetHolder 当前工作表持有者 |
||||
* @param cell 当前单元格 |
||||
* @param curRowIndex 当前行索引 |
||||
* @param curColIndex 当前列索引 |
||||
*/ |
||||
private void mergeWithPrevRow(WriteSheetHolder writeSheetHolder, Cell cell, int curRowIndex, int curColIndex) { |
||||
// 获取当前行的当前列的数据和上一行的当前列列数据,通过上一行数据是否相同进行合并
|
||||
Object curData = cell.getCellTypeEnum() == CellType.STRING ? cell.getStringCellValue() : cell.getNumericCellValue(); |
||||
// 获取前一个单元格的数据
|
||||
Cell preCell = cell.getSheet().getRow(curRowIndex - 1).getCell(curColIndex); |
||||
Object preData = preCell.getCellTypeEnum() == CellType.STRING ? preCell.getStringCellValue() : preCell.getNumericCellValue(); |
||||
|
||||
// 当前交易单号
|
||||
Cell curOrderNo = cell.getSheet().getRow(curRowIndex).getCell(0); |
||||
// 上一条交易单号
|
||||
Cell preOrderNo = cell.getSheet().getRow(curRowIndex - 1).getCell(0); |
||||
|
||||
// 判断当前单元格和前一个单元格的数据以及主键是否相同
|
||||
if (curData.equals(preData) && curOrderNo.getStringCellValue().equals(preOrderNo.getStringCellValue())) { |
||||
// 获取工作表
|
||||
Sheet sheet = writeSheetHolder.getSheet(); |
||||
// 获取已合并的区域
|
||||
List<CellRangeAddress> mergeRegions = sheet.getMergedRegions(); |
||||
boolean isMerged = false; |
||||
// 检查前一个单元格是否已经被合并
|
||||
for (int i = 0; i < mergeRegions.size() && !isMerged; i++) { |
||||
CellRangeAddress cellRangeAddr = mergeRegions.get(i); |
||||
// 若上一个单元格已经被合并,则先移出原有的合并单元,再重新添加合并单元
|
||||
if (cellRangeAddr.isInRange(curRowIndex - 1, curColIndex)) { |
||||
sheet.removeMergedRegion(i); |
||||
cellRangeAddr.setLastRow(curRowIndex); |
||||
sheet.addMergedRegion(cellRangeAddr); |
||||
isMerged = true; |
||||
} |
||||
} |
||||
// 如果前一个单元格未被合并,则新增合并区域
|
||||
if (!isMerged) { |
||||
CellRangeAddress cellRangeAddress = new CellRangeAddress(curRowIndex - 1, curRowIndex, curColIndex, curColIndex); |
||||
sheet.addMergedRegion(cellRangeAddress); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void afterCellDataConverted(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, CellData cellData, Cell cell, Head head, Integer integer, Boolean aBoolean) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, List<CellData> list, Cell cell, Head head, Integer integer, Boolean aBoolean) { |
||||
// 当前行索引
|
||||
int curRowIndex = cell.getRowIndex(); |
||||
// 当前列索引
|
||||
int curColIndex = cell.getColumnIndex(); |
||||
// 如果当前行大于合并开始行
|
||||
if (curRowIndex > mergeRowIndex) { |
||||
// 当前列在需要合并的列中
|
||||
for (int columnIndex : mergeColumnIndex) { |
||||
if (curColIndex == columnIndex) { |
||||
// 进行合并操作
|
||||
mergeWithPrevRow(writeSheetHolder, cell, curRowIndex, curColIndex); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,100 @@ |
||||
package com.hfkj.schedule; |
||||
|
||||
import com.alibaba.fastjson.JSONArray; |
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import com.hfkj.common.utils.DateUtil; |
||||
import com.hfkj.entity.BsOrderGoods; |
||||
import com.hfkj.entity.GoodsLogistics; |
||||
import com.hfkj.entity.GoodsUserAddress; |
||||
import com.hfkj.service.goods.BsOrderGoodsService; |
||||
import com.hfkj.service.goods.GoodsUserAddressService; |
||||
import com.hfkj.sysenum.order.OrderLogisticsStatusEnum; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.scheduling.annotation.Scheduled; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Date; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @ClassName OrderGoodsSchedule |
||||
* @Author Sum1Dream |
||||
* @Description 实物订单定时任务 |
||||
* @Date 2024/8/12 下午3:00 |
||||
**/ |
||||
@Configuration |
||||
public class OrderGoodsSchedule { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(OrderGoodsSchedule.class); |
||||
|
||||
@Resource |
||||
private BsOrderGoodsService orderGoodsService; |
||||
@Resource |
||||
private BsOrderGoodsService bsOrderGoodsService; |
||||
|
||||
@Resource |
||||
private GoodsUserAddressService addressService; |
||||
|
||||
//每日凌晨12点5秒执行一次
|
||||
@Scheduled(cron = "5 0 0 * * ?") |
||||
public void orderGoodsConfirmReceipt() { |
||||
Map<String , Object> map = new HashMap<>(); |
||||
|
||||
map.put("logisticsStatus" , "SIGN"); |
||||
map.put("status" , 2); |
||||
|
||||
List<BsOrderGoods> orderGoodsList = orderGoodsService.getList(map); |
||||
|
||||
for (BsOrderGoods goods : orderGoodsList) { |
||||
|
||||
// 判断时间是否是十天前
|
||||
|
||||
if (DateUtil.differentDays(goods.getCreateTime() , new Date()) > 10) { |
||||
bsOrderGoodsService.confirmReceipt(goods.getId()); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Scheduled(cron = "30 0 0 * * ?") |
||||
public void getLogisticsMsg() { |
||||
Map<String , Object> objectMap = new HashMap<>(); |
||||
|
||||
objectMap.put("status" , 2); |
||||
|
||||
List<BsOrderGoods> orderGoodsList = orderGoodsService.getList(objectMap); |
||||
|
||||
for (BsOrderGoods goods : orderGoodsList) { |
||||
|
||||
if (goods == null) { |
||||
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!"); |
||||
} |
||||
|
||||
GoodsUserAddress userAddress = addressService.queryDetail(goods.getDeliveryAddressId()); |
||||
|
||||
if (userAddress == null) { |
||||
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!"); |
||||
} |
||||
|
||||
GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(goods.getLogisticsNo() , userAddress.getPhone()); |
||||
|
||||
if (logistics.getLogisticsStatus() != null) { |
||||
goods.setLogisticsStatus(logistics.getLogisticsStatus()); |
||||
goods.setLogisticsStatusDesc(logistics.getLogisticsStatusDesc()); |
||||
} else { |
||||
goods.setLogisticsStatus(OrderLogisticsStatusEnum.statusWAIT_ACCEPT.getCode()); |
||||
goods.setLogisticsStatusDesc(OrderLogisticsStatusEnum.statusWAIT_ACCEPT.getName()); |
||||
} |
||||
|
||||
goods.setUpdateTime(new Date()); |
||||
|
||||
bsOrderGoodsService.update(goods); |
||||
|
||||
} |
||||
} |
||||
} |
Binary file not shown.
@ -0,0 +1,23 @@ |
||||
package com.hfkj.common.utils; |
||||
|
||||
import java.util.Random; |
||||
|
||||
/** |
||||
* @ClassName RandomStringGeneratorUtil |
||||
* @Author Sum1Dream |
||||
* @Description 生成随机数 |
||||
* @Date 2024/8/27 上午11:33 |
||||
**/ |
||||
public class RandomStringGeneratorUtil { |
||||
|
||||
public static String generateRandomString(int stringLength) { |
||||
char[] chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".toCharArray(); |
||||
StringBuilder sb = new StringBuilder(); |
||||
Random random = new Random(); |
||||
for (int i = 0; i < stringLength; i++) { |
||||
char c = chars[random.nextInt(chars.length)]; |
||||
sb.append(c); |
||||
} |
||||
return sb.toString(); |
||||
} |
||||
} |
@ -0,0 +1,147 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.BsHltCardRecord; |
||||
import com.hfkj.entity.BsHltCardRecordExample; |
||||
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 BsHltCardRecordMapper extends BsHltCardRecordMapperExt { |
||||
@SelectProvider(type=BsHltCardRecordSqlProvider.class, method="countByExample") |
||||
long countByExample(BsHltCardRecordExample example); |
||||
|
||||
@DeleteProvider(type=BsHltCardRecordSqlProvider.class, method="deleteByExample") |
||||
int deleteByExample(BsHltCardRecordExample example); |
||||
|
||||
@Delete({ |
||||
"delete from bs_hlt_card_record", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int deleteByPrimaryKey(Long id); |
||||
|
||||
@Insert({ |
||||
"insert into bs_hlt_card_record (order_no, card_no, ", |
||||
"user_phone, pay_order_no, ", |
||||
"pay_serial_no, pay_price, ", |
||||
"pay_status, create_time, ", |
||||
"update_time, pay_time, ", |
||||
"refund_time, exception_status, ", |
||||
"exception_content, ext_1, ", |
||||
"ext_2, ext_3)", |
||||
"values (#{orderNo,jdbcType=VARCHAR}, #{cardNo,jdbcType=VARCHAR}, ", |
||||
"#{userPhone,jdbcType=VARCHAR}, #{payOrderNo,jdbcType=VARCHAR}, ", |
||||
"#{paySerialNo,jdbcType=VARCHAR}, #{payPrice,jdbcType=DECIMAL}, ", |
||||
"#{payStatus,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", |
||||
"#{updateTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, ", |
||||
"#{refundTime,jdbcType=TIMESTAMP}, #{exceptionStatus,jdbcType=BIT}, ", |
||||
"#{exceptionContent,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ", |
||||
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" |
||||
}) |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insert(BsHltCardRecord record); |
||||
|
||||
@InsertProvider(type=BsHltCardRecordSqlProvider.class, method="insertSelective") |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insertSelective(BsHltCardRecord record); |
||||
|
||||
@SelectProvider(type=BsHltCardRecordSqlProvider.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="card_no", property="cardNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="pay_order_no", property="payOrderNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL), |
||||
@Result(column="pay_status", property="payStatus", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="refund_time", property="refundTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="exception_status", property="exceptionStatus", jdbcType=JdbcType.BIT), |
||||
@Result(column="exception_content", property="exceptionContent", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
List<BsHltCardRecord> selectByExample(BsHltCardRecordExample example); |
||||
|
||||
@Select({ |
||||
"select", |
||||
"id, order_no, card_no, user_phone, pay_order_no, pay_serial_no, pay_price, pay_status, ", |
||||
"create_time, update_time, pay_time, refund_time, exception_status, exception_content, ", |
||||
"ext_1, ext_2, ext_3", |
||||
"from bs_hlt_card_record", |
||||
"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="card_no", property="cardNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="pay_order_no", property="payOrderNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL), |
||||
@Result(column="pay_status", property="payStatus", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="refund_time", property="refundTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="exception_status", property="exceptionStatus", jdbcType=JdbcType.BIT), |
||||
@Result(column="exception_content", property="exceptionContent", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
BsHltCardRecord selectByPrimaryKey(Long id); |
||||
|
||||
@UpdateProvider(type=BsHltCardRecordSqlProvider.class, method="updateByExampleSelective") |
||||
int updateByExampleSelective(@Param("record") BsHltCardRecord record, @Param("example") BsHltCardRecordExample example); |
||||
|
||||
@UpdateProvider(type=BsHltCardRecordSqlProvider.class, method="updateByExample") |
||||
int updateByExample(@Param("record") BsHltCardRecord record, @Param("example") BsHltCardRecordExample example); |
||||
|
||||
@UpdateProvider(type=BsHltCardRecordSqlProvider.class, method="updateByPrimaryKeySelective") |
||||
int updateByPrimaryKeySelective(BsHltCardRecord record); |
||||
|
||||
@Update({ |
||||
"update bs_hlt_card_record", |
||||
"set order_no = #{orderNo,jdbcType=VARCHAR},", |
||||
"card_no = #{cardNo,jdbcType=VARCHAR},", |
||||
"user_phone = #{userPhone,jdbcType=VARCHAR},", |
||||
"pay_order_no = #{payOrderNo,jdbcType=VARCHAR},", |
||||
"pay_serial_no = #{paySerialNo,jdbcType=VARCHAR},", |
||||
"pay_price = #{payPrice,jdbcType=DECIMAL},", |
||||
"pay_status = #{payStatus,jdbcType=INTEGER},", |
||||
"create_time = #{createTime,jdbcType=TIMESTAMP},", |
||||
"update_time = #{updateTime,jdbcType=TIMESTAMP},", |
||||
"pay_time = #{payTime,jdbcType=TIMESTAMP},", |
||||
"refund_time = #{refundTime,jdbcType=TIMESTAMP},", |
||||
"exception_status = #{exceptionStatus,jdbcType=BIT},", |
||||
"exception_content = #{exceptionContent,jdbcType=VARCHAR},", |
||||
"ext_1 = #{ext1,jdbcType=VARCHAR},", |
||||
"ext_2 = #{ext2,jdbcType=VARCHAR},", |
||||
"ext_3 = #{ext3,jdbcType=VARCHAR}", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int updateByPrimaryKey(BsHltCardRecord record); |
||||
} |
@ -0,0 +1,7 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
/** |
||||
* mapper扩展类 |
||||
*/ |
||||
public interface BsHltCardRecordMapperExt { |
||||
} |
@ -0,0 +1,402 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.BsHltCardRecord; |
||||
import com.hfkj.entity.BsHltCardRecordExample.Criteria; |
||||
import com.hfkj.entity.BsHltCardRecordExample.Criterion; |
||||
import com.hfkj.entity.BsHltCardRecordExample; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import org.apache.ibatis.jdbc.SQL; |
||||
|
||||
public class BsHltCardRecordSqlProvider { |
||||
|
||||
public String countByExample(BsHltCardRecordExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.SELECT("count(*)").FROM("bs_hlt_card_record"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String deleteByExample(BsHltCardRecordExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.DELETE_FROM("bs_hlt_card_record"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String insertSelective(BsHltCardRecord record) { |
||||
SQL sql = new SQL(); |
||||
sql.INSERT_INTO("bs_hlt_card_record"); |
||||
|
||||
if (record.getOrderNo() != null) { |
||||
sql.VALUES("order_no", "#{orderNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getCardNo() != null) { |
||||
sql.VALUES("card_no", "#{cardNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getUserPhone() != null) { |
||||
sql.VALUES("user_phone", "#{userPhone,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getPayOrderNo() != null) { |
||||
sql.VALUES("pay_order_no", "#{payOrderNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getPaySerialNo() != null) { |
||||
sql.VALUES("pay_serial_no", "#{paySerialNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getPayPrice() != null) { |
||||
sql.VALUES("pay_price", "#{payPrice,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getPayStatus() != null) { |
||||
sql.VALUES("pay_status", "#{payStatus,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getPayTime() != null) { |
||||
sql.VALUES("pay_time", "#{payTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getRefundTime() != null) { |
||||
sql.VALUES("refund_time", "#{refundTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getExceptionStatus() != null) { |
||||
sql.VALUES("exception_status", "#{exceptionStatus,jdbcType=BIT}"); |
||||
} |
||||
|
||||
if (record.getExceptionContent() != null) { |
||||
sql.VALUES("exception_content", "#{exceptionContent,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String selectByExample(BsHltCardRecordExample example) { |
||||
SQL sql = new SQL(); |
||||
if (example != null && example.isDistinct()) { |
||||
sql.SELECT_DISTINCT("id"); |
||||
} else { |
||||
sql.SELECT("id"); |
||||
} |
||||
sql.SELECT("order_no"); |
||||
sql.SELECT("card_no"); |
||||
sql.SELECT("user_phone"); |
||||
sql.SELECT("pay_order_no"); |
||||
sql.SELECT("pay_serial_no"); |
||||
sql.SELECT("pay_price"); |
||||
sql.SELECT("pay_status"); |
||||
sql.SELECT("create_time"); |
||||
sql.SELECT("update_time"); |
||||
sql.SELECT("pay_time"); |
||||
sql.SELECT("refund_time"); |
||||
sql.SELECT("exception_status"); |
||||
sql.SELECT("exception_content"); |
||||
sql.SELECT("ext_1"); |
||||
sql.SELECT("ext_2"); |
||||
sql.SELECT("ext_3"); |
||||
sql.FROM("bs_hlt_card_record"); |
||||
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) { |
||||
BsHltCardRecord record = (BsHltCardRecord) parameter.get("record"); |
||||
BsHltCardRecordExample example = (BsHltCardRecordExample) parameter.get("example"); |
||||
|
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("bs_hlt_card_record"); |
||||
|
||||
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.getCardNo() != null) { |
||||
sql.SET("card_no = #{record.cardNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getUserPhone() != null) { |
||||
sql.SET("user_phone = #{record.userPhone,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getPayOrderNo() != null) { |
||||
sql.SET("pay_order_no = #{record.payOrderNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getPaySerialNo() != null) { |
||||
sql.SET("pay_serial_no = #{record.paySerialNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getPayPrice() != null) { |
||||
sql.SET("pay_price = #{record.payPrice,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getPayStatus() != null) { |
||||
sql.SET("pay_status = #{record.payStatus,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getPayTime() != null) { |
||||
sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getRefundTime() != null) { |
||||
sql.SET("refund_time = #{record.refundTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getExceptionStatus() != null) { |
||||
sql.SET("exception_status = #{record.exceptionStatus,jdbcType=BIT}"); |
||||
} |
||||
|
||||
if (record.getExceptionContent() != null) { |
||||
sql.SET("exception_content = #{record.exceptionContent,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByExample(Map<String, Object> parameter) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("bs_hlt_card_record"); |
||||
|
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}"); |
||||
sql.SET("card_no = #{record.cardNo,jdbcType=VARCHAR}"); |
||||
sql.SET("user_phone = #{record.userPhone,jdbcType=VARCHAR}"); |
||||
sql.SET("pay_order_no = #{record.payOrderNo,jdbcType=VARCHAR}"); |
||||
sql.SET("pay_serial_no = #{record.paySerialNo,jdbcType=VARCHAR}"); |
||||
sql.SET("pay_price = #{record.payPrice,jdbcType=DECIMAL}"); |
||||
sql.SET("pay_status = #{record.payStatus,jdbcType=INTEGER}"); |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("refund_time = #{record.refundTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("exception_status = #{record.exceptionStatus,jdbcType=BIT}"); |
||||
sql.SET("exception_content = #{record.exceptionContent,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
|
||||
BsHltCardRecordExample example = (BsHltCardRecordExample) parameter.get("example"); |
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByPrimaryKeySelective(BsHltCardRecord record) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("bs_hlt_card_record"); |
||||
|
||||
if (record.getOrderNo() != null) { |
||||
sql.SET("order_no = #{orderNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getCardNo() != null) { |
||||
sql.SET("card_no = #{cardNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getUserPhone() != null) { |
||||
sql.SET("user_phone = #{userPhone,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getPayOrderNo() != null) { |
||||
sql.SET("pay_order_no = #{payOrderNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getPaySerialNo() != null) { |
||||
sql.SET("pay_serial_no = #{paySerialNo,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getPayPrice() != null) { |
||||
sql.SET("pay_price = #{payPrice,jdbcType=DECIMAL}"); |
||||
} |
||||
|
||||
if (record.getPayStatus() != null) { |
||||
sql.SET("pay_status = #{payStatus,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getPayTime() != null) { |
||||
sql.SET("pay_time = #{payTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getRefundTime() != null) { |
||||
sql.SET("refund_time = #{refundTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getExceptionStatus() != null) { |
||||
sql.SET("exception_status = #{exceptionStatus,jdbcType=BIT}"); |
||||
} |
||||
|
||||
if (record.getExceptionContent() != null) { |
||||
sql.SET("exception_content = #{exceptionContent,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
sql.WHERE("id = #{id,jdbcType=BIGINT}"); |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
protected void applyWhere(SQL sql, BsHltCardRecordExample 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,313 @@ |
||||
package com.hfkj.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* bs_hlt_card_record |
||||
* @author |
||||
*/ |
||||
/** |
||||
* |
||||
* 代码由工具生成 |
||||
* |
||||
**/ |
||||
public class BsHltCardRecord implements Serializable { |
||||
/** |
||||
* 主键 |
||||
*/ |
||||
private Long id; |
||||
|
||||
/** |
||||
* 订单号 |
||||
*/ |
||||
private String orderNo; |
||||
|
||||
/** |
||||
* 卡号 |
||||
*/ |
||||
private String cardNo; |
||||
|
||||
/** |
||||
* 用户电话 |
||||
*/ |
||||
private String userPhone; |
||||
|
||||
/** |
||||
* 支付订单号 |
||||
*/ |
||||
private String payOrderNo; |
||||
|
||||
/** |
||||
* 渠道支付订单号 |
||||
*/ |
||||
private String paySerialNo; |
||||
|
||||
/** |
||||
* 支付金额 |
||||
*/ |
||||
private BigDecimal payPrice; |
||||
|
||||
/** |
||||
* 支付状态 1:待支付 2:已支付 3:已退款 |
||||
*/ |
||||
private Integer payStatus; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* 修改时间 |
||||
*/ |
||||
private Date updateTime; |
||||
|
||||
/** |
||||
* 支付时间 |
||||
*/ |
||||
private Date payTime; |
||||
|
||||
/** |
||||
* 退款时间 |
||||
*/ |
||||
private Date refundTime; |
||||
|
||||
/** |
||||
* 是否异常0:否 1:是 |
||||
*/ |
||||
private Boolean exceptionStatus; |
||||
|
||||
/** |
||||
* 异常内容 |
||||
*/ |
||||
private String exceptionContent; |
||||
|
||||
private String ext1; |
||||
|
||||
private String ext2; |
||||
|
||||
private String ext3; |
||||
|
||||
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 String getCardNo() { |
||||
return cardNo; |
||||
} |
||||
|
||||
public void setCardNo(String cardNo) { |
||||
this.cardNo = cardNo; |
||||
} |
||||
|
||||
public String getUserPhone() { |
||||
return userPhone; |
||||
} |
||||
|
||||
public void setUserPhone(String userPhone) { |
||||
this.userPhone = userPhone; |
||||
} |
||||
|
||||
public String getPayOrderNo() { |
||||
return payOrderNo; |
||||
} |
||||
|
||||
public void setPayOrderNo(String payOrderNo) { |
||||
this.payOrderNo = payOrderNo; |
||||
} |
||||
|
||||
public String getPaySerialNo() { |
||||
return paySerialNo; |
||||
} |
||||
|
||||
public void setPaySerialNo(String paySerialNo) { |
||||
this.paySerialNo = paySerialNo; |
||||
} |
||||
|
||||
public BigDecimal getPayPrice() { |
||||
return payPrice; |
||||
} |
||||
|
||||
public void setPayPrice(BigDecimal payPrice) { |
||||
this.payPrice = payPrice; |
||||
} |
||||
|
||||
public Integer getPayStatus() { |
||||
return payStatus; |
||||
} |
||||
|
||||
public void setPayStatus(Integer payStatus) { |
||||
this.payStatus = payStatus; |
||||
} |
||||
|
||||
public Date getCreateTime() { |
||||
return createTime; |
||||
} |
||||
|
||||
public void setCreateTime(Date createTime) { |
||||
this.createTime = createTime; |
||||
} |
||||
|
||||
public Date getUpdateTime() { |
||||
return updateTime; |
||||
} |
||||
|
||||
public void setUpdateTime(Date updateTime) { |
||||
this.updateTime = updateTime; |
||||
} |
||||
|
||||
public Date getPayTime() { |
||||
return payTime; |
||||
} |
||||
|
||||
public void setPayTime(Date payTime) { |
||||
this.payTime = payTime; |
||||
} |
||||
|
||||
public Date getRefundTime() { |
||||
return refundTime; |
||||
} |
||||
|
||||
public void setRefundTime(Date refundTime) { |
||||
this.refundTime = refundTime; |
||||
} |
||||
|
||||
public Boolean getExceptionStatus() { |
||||
return exceptionStatus; |
||||
} |
||||
|
||||
public void setExceptionStatus(Boolean exceptionStatus) { |
||||
this.exceptionStatus = exceptionStatus; |
||||
} |
||||
|
||||
public String getExceptionContent() { |
||||
return exceptionContent; |
||||
} |
||||
|
||||
public void setExceptionContent(String exceptionContent) { |
||||
this.exceptionContent = exceptionContent; |
||||
} |
||||
|
||||
public String getExt1() { |
||||
return ext1; |
||||
} |
||||
|
||||
public void setExt1(String ext1) { |
||||
this.ext1 = ext1; |
||||
} |
||||
|
||||
public String getExt2() { |
||||
return ext2; |
||||
} |
||||
|
||||
public void setExt2(String ext2) { |
||||
this.ext2 = ext2; |
||||
} |
||||
|
||||
public String getExt3() { |
||||
return ext3; |
||||
} |
||||
|
||||
public void setExt3(String ext3) { |
||||
this.ext3 = ext3; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object that) { |
||||
if (this == that) { |
||||
return true; |
||||
} |
||||
if (that == null) { |
||||
return false; |
||||
} |
||||
if (getClass() != that.getClass()) { |
||||
return false; |
||||
} |
||||
BsHltCardRecord other = (BsHltCardRecord) 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.getCardNo() == null ? other.getCardNo() == null : this.getCardNo().equals(other.getCardNo())) |
||||
&& (this.getUserPhone() == null ? other.getUserPhone() == null : this.getUserPhone().equals(other.getUserPhone())) |
||||
&& (this.getPayOrderNo() == null ? other.getPayOrderNo() == null : this.getPayOrderNo().equals(other.getPayOrderNo())) |
||||
&& (this.getPaySerialNo() == null ? other.getPaySerialNo() == null : this.getPaySerialNo().equals(other.getPaySerialNo())) |
||||
&& (this.getPayPrice() == null ? other.getPayPrice() == null : this.getPayPrice().equals(other.getPayPrice())) |
||||
&& (this.getPayStatus() == null ? other.getPayStatus() == null : this.getPayStatus().equals(other.getPayStatus())) |
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) |
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) |
||||
&& (this.getPayTime() == null ? other.getPayTime() == null : this.getPayTime().equals(other.getPayTime())) |
||||
&& (this.getRefundTime() == null ? other.getRefundTime() == null : this.getRefundTime().equals(other.getRefundTime())) |
||||
&& (this.getExceptionStatus() == null ? other.getExceptionStatus() == null : this.getExceptionStatus().equals(other.getExceptionStatus())) |
||||
&& (this.getExceptionContent() == null ? other.getExceptionContent() == null : this.getExceptionContent().equals(other.getExceptionContent())) |
||||
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) |
||||
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) |
||||
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); |
||||
} |
||||
|
||||
@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 + ((getCardNo() == null) ? 0 : getCardNo().hashCode()); |
||||
result = prime * result + ((getUserPhone() == null) ? 0 : getUserPhone().hashCode()); |
||||
result = prime * result + ((getPayOrderNo() == null) ? 0 : getPayOrderNo().hashCode()); |
||||
result = prime * result + ((getPaySerialNo() == null) ? 0 : getPaySerialNo().hashCode()); |
||||
result = prime * result + ((getPayPrice() == null) ? 0 : getPayPrice().hashCode()); |
||||
result = prime * result + ((getPayStatus() == null) ? 0 : getPayStatus().hashCode()); |
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); |
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); |
||||
result = prime * result + ((getPayTime() == null) ? 0 : getPayTime().hashCode()); |
||||
result = prime * result + ((getRefundTime() == null) ? 0 : getRefundTime().hashCode()); |
||||
result = prime * result + ((getExceptionStatus() == null) ? 0 : getExceptionStatus().hashCode()); |
||||
result = prime * result + ((getExceptionContent() == null) ? 0 : getExceptionContent().hashCode()); |
||||
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); |
||||
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); |
||||
result = prime * result + ((getExt3() == null) ? 0 : getExt3().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(", cardNo=").append(cardNo); |
||||
sb.append(", userPhone=").append(userPhone); |
||||
sb.append(", payOrderNo=").append(payOrderNo); |
||||
sb.append(", paySerialNo=").append(paySerialNo); |
||||
sb.append(", payPrice=").append(payPrice); |
||||
sb.append(", payStatus=").append(payStatus); |
||||
sb.append(", createTime=").append(createTime); |
||||
sb.append(", updateTime=").append(updateTime); |
||||
sb.append(", payTime=").append(payTime); |
||||
sb.append(", refundTime=").append(refundTime); |
||||
sb.append(", exceptionStatus=").append(exceptionStatus); |
||||
sb.append(", exceptionContent=").append(exceptionContent); |
||||
sb.append(", ext1=").append(ext1); |
||||
sb.append(", ext2=").append(ext2); |
||||
sb.append(", ext3=").append(ext3); |
||||
sb.append(", serialVersionUID=").append(serialVersionUID); |
||||
sb.append("]"); |
||||
return sb.toString(); |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,74 @@ |
||||
package com.hfkj.meituan; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import com.hfkj.common.utils.HttpsUtils; |
||||
import com.hfkj.config.CommonSysConst; |
||||
|
||||
import com.meituan.sqt.utils.EncryptUtil; |
||||
import com.meituan.sqt.utils.JsonUtil; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
|
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @ClassName MeiTuanService |
||||
* @Author Sum1Dream |
||||
* @Description 美团接口 |
||||
* @Date 2024/8/26 下午4:52 |
||||
**/ |
||||
public class MeiTuanService { |
||||
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(MeiTuanService.class); |
||||
|
||||
|
||||
/** |
||||
* @MethodName loginFree |
||||
* @Description: H5免登接口 |
||||
* @param map |
||||
* @return: com.alibaba.fastjson.JSONObject |
||||
* @Author: Sum1Dream |
||||
* @Date: 2024/8/27 上午11:16 |
||||
*/ |
||||
public static JSONObject loginFree(Map<String , Object> map) throws Exception { |
||||
|
||||
JSONObject object = request("" , map); |
||||
|
||||
if (object.getBoolean("success") && object.getInteger("code") == 10000) { |
||||
return object; |
||||
} else { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "查询失败!"); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 请求 |
||||
* @param postUrl 接口请求地址 |
||||
* @param param 参数 |
||||
* @return |
||||
* @throws Exception |
||||
*/ |
||||
public static JSONObject request(String postUrl, Map<String,Object> param) throws Exception { |
||||
|
||||
|
||||
|
||||
log.info("============ 千猪请求-START ============="); |
||||
param.put("accessKey", CommonSysConst.getSysConfig().getMtAccessKey()); |
||||
param.put("content", EncryptUtil.aesEncrypt(JsonUtil.object2Json(param), CommonSysConst.getSysConfig().getMtSecretKey())); |
||||
|
||||
log.info("请求接口:" + postUrl); |
||||
log.info("请求参数:" + JSONObject.toJSONString(param)); |
||||
|
||||
JSONObject response = HttpsUtils.doPost(CommonSysConst.getSysConfig().getMtPostUrl() + postUrl, JSONObject.toJSONString(param)); |
||||
|
||||
log.info("响应参数:" + response.toJSONString()); |
||||
log.info("============ 千猪请求-END =============="); |
||||
return response; |
||||
|
||||
} |
||||
} |
@ -0,0 +1,116 @@ |
||||
package com.hfkj.model.order.orderExport; |
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty; |
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @ClassName OrderGoodsExportModel |
||||
* @Author Sum1Dream |
||||
* @Description 实物订单导出 |
||||
* @Date 2024/8/12 下午5:07 |
||||
**/ |
||||
@Data |
||||
public class OrderGoodsExportModel { |
||||
|
||||
@ColumnWidth(50) |
||||
@ExcelProperty("商品名称") |
||||
public String goodsName; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty("商户名称") |
||||
public String merName; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty("类型名称") |
||||
public String goodsTypeName; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty("品牌名称") |
||||
public String goodsBrandName; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty("用户手机号") |
||||
public String userPhone; |
||||
|
||||
@ColumnWidth(40) |
||||
@ExcelProperty("订单号") |
||||
public String orderNo; |
||||
|
||||
@ColumnWidth(15) |
||||
@ExcelProperty("子订单号") |
||||
public String childOrderNo; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty("物流单号") |
||||
public String logisticsNo; |
||||
|
||||
@ColumnWidth(30) |
||||
@ExcelProperty("商品规格") |
||||
public String goodsSpecsName; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty("商品价格") |
||||
public BigDecimal goodsPrice; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty("购买数量") |
||||
public Integer goodsCount; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty({"交易信息", "订单金额"}) |
||||
public BigDecimal totalPrice; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty({"交易信息", "总优惠"}) |
||||
public BigDecimal totalDeductionPrice; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty({"交易信息", "优惠券优惠"}) |
||||
public BigDecimal couponDiscountPrice; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty({"交易信息", "积分抵扣"}) |
||||
public BigDecimal integralDiscountPrice; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty({"交易信息", "实付金额"}) |
||||
public BigDecimal payRealPrice; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty({"交易信息", "支付渠道"}) |
||||
public String payChannel; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty({"交易信息", "支付方式"}) |
||||
public String payType; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty({"交易信息", "支付单号"}) |
||||
public String paySerialNo; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty({"交易信息", "交易状态"}) |
||||
public String tradeStatus; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty({"交易信息", "创建时间"}) |
||||
public Date createTime; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty({"交易信息", "支付时间"}) |
||||
public Date payTime; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty("物流状态") |
||||
public String logisticsStatusDesc; |
||||
|
||||
@ColumnWidth(20) |
||||
@ExcelProperty("完成时间") |
||||
public Date finishTime; |
||||
|
||||
|
||||
} |
@ -0,0 +1,83 @@ |
||||
package com.hfkj.service.file; |
||||
|
||||
import com.hfkj.entity.FileRecords; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @ClassName FileRecordsService |
||||
* @Author Sum1Dream |
||||
* @Description 文件记录 |
||||
* @Date 2024/8/12 下午2:04 |
||||
**/ |
||||
public interface FileRecordsService { |
||||
|
||||
/** |
||||
* @MethodName create |
||||
* @Description: 创建 |
||||
* @param fileRecords |
||||
* @Author: Sum1Dream |
||||
* @Date: 2024/8/12 下午2:06 |
||||
*/ |
||||
void create(FileRecords fileRecords); |
||||
|
||||
/** |
||||
* @MethodName update |
||||
* @Description: 更新 |
||||
* @param fileRecords |
||||
* @Author: Sum1Dream |
||||
* @Date: 2024/8/12 下午2:06 |
||||
*/ |
||||
void update(FileRecords fileRecords); |
||||
|
||||
/** |
||||
* @MethodName delete |
||||
* @Description: 删除 |
||||
* @param id |
||||
* @param fullDelete |
||||
* @Author: Sum1Dream |
||||
* @Date: 2024/8/12 下午2:06 |
||||
*/ |
||||
void delete(Long id , Boolean fullDelete); |
||||
|
||||
/** |
||||
* @MethodName queryDetail |
||||
* @Description: 查询详情 |
||||
* @param id |
||||
* @return: com.hfkj.entity.FileRecords |
||||
* @Author: Sum1Dream |
||||
* @Date: 2024/8/12 下午2:07 |
||||
*/ |
||||
FileRecords queryDetail(Long id); |
||||
|
||||
/** |
||||
* @MethodName queryDetailByMap |
||||
* @Description: 查询 |
||||
* @param map |
||||
* @return: com.hfkj.entity.FileRecords |
||||
* @Author: Sum1Dream |
||||
* @Date: 2024/8/12 下午2:07 |
||||
*/ |
||||
FileRecords queryDetailByMap(Map<String , Object> map); |
||||
|
||||
/** |
||||
* @MethodName getList |
||||
* @Description: 查询列表 |
||||
* @param map |
||||
* @return: java.util.List<com.hfkj.entity.FileRecords> |
||||
* @Author: Sum1Dream |
||||
* @Date: 2024/8/12 下午2:07 |
||||
*/ |
||||
List<FileRecords> getList(Map<String , Object> map); |
||||
|
||||
/** |
||||
* @MethodName findExported |
||||
* @Description: 是否可以导出 |
||||
* @param content |
||||
* @return: java.lang.Boolean |
||||
* @Author: Sum1Dream |
||||
* @Date: 2024/8/14 下午5:03 |
||||
*/ |
||||
Boolean findExported(String content , Long opId); |
||||
} |
@ -0,0 +1,71 @@ |
||||
package com.hfkj.service.file.impl; |
||||
|
||||
import com.hfkj.dao.FileRecordsMapper; |
||||
import com.hfkj.entity.FileRecords; |
||||
import com.hfkj.entity.FileRecordsExample; |
||||
import com.hfkj.service.file.FileRecordsService; |
||||
import org.apache.commons.collections4.MapUtils; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Collections; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Service("fileRecordsService") |
||||
public class FileRecordsServiceImpl implements FileRecordsService { |
||||
|
||||
@Resource |
||||
private FileRecordsMapper fileRecordsMapper; |
||||
|
||||
@Override |
||||
public void create(FileRecords fileRecords) { |
||||
fileRecordsMapper.insert(fileRecords); |
||||
} |
||||
|
||||
@Override |
||||
public void update(FileRecords fileRecords) { |
||||
fileRecordsMapper.updateByPrimaryKeySelective(fileRecords); |
||||
} |
||||
|
||||
@Override |
||||
public void delete(Long id, Boolean fullDelete) { |
||||
fileRecordsMapper.deleteByPrimaryKey(id); |
||||
} |
||||
|
||||
@Override |
||||
public FileRecords queryDetail(Long id) { |
||||
return fileRecordsMapper.selectByPrimaryKey(id); |
||||
} |
||||
|
||||
@Override |
||||
public FileRecords queryDetailByMap(Map<String, Object> map) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public List<FileRecords> getList(Map<String, Object> map) { |
||||
|
||||
FileRecordsExample example = new FileRecordsExample(); |
||||
FileRecordsExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
if (MapUtils.getLong(map, "opId") != null) { |
||||
criteria.andOpIdEqualTo(MapUtils.getLong(map, "opId")); |
||||
} |
||||
example.setOrderByClause("create_time desc"); |
||||
return fileRecordsMapper.selectByExample(example); |
||||
} |
||||
|
||||
@Override |
||||
public Boolean findExported(String content , Long opId) { |
||||
|
||||
FileRecordsExample example = new FileRecordsExample(); |
||||
FileRecordsExample.Criteria criteria = example.createCriteria(); |
||||
|
||||
criteria.andDownloadConditionsEqualTo(content).andOpIdEqualTo(opId).andStatusEqualTo(2); |
||||
|
||||
List<FileRecords> list = fileRecordsMapper.selectByExample(example); |
||||
|
||||
return !list.isEmpty(); |
||||
} |
||||
} |
@ -0,0 +1,59 @@ |
||||
package com.hfkj.service.hlt; |
||||
|
||||
import com.hfkj.dao.BsHltCardRecordMapper; |
||||
import com.hfkj.entity.BsHltCardRecord; |
||||
import com.hfkj.entity.BsHltCardRecordExample; |
||||
import com.hfkj.sysenum.hlt.HltCardRecordPayStatusEnum; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @className: BsHltCardRecordService |
||||
* @author: HuRui |
||||
* @date: 2024/8/21 |
||||
**/ |
||||
@Component |
||||
public class BsHltCardRecordService { |
||||
@Resource |
||||
private BsHltCardRecordMapper hltCardRecordMapper; |
||||
|
||||
/** |
||||
* 创建 |
||||
* @param record |
||||
*/ |
||||
public void create(BsHltCardRecord record) { |
||||
record.setCreateTime(new Date()); |
||||
record.setUpdateTime(new Date()); |
||||
hltCardRecordMapper.insert(record); |
||||
} |
||||
|
||||
/** |
||||
* 修改 |
||||
* @param record |
||||
*/ |
||||
public void update(BsHltCardRecord record) { |
||||
record.setUpdateTime(new Date()); |
||||
hltCardRecordMapper.updateByPrimaryKey(record); |
||||
} |
||||
|
||||
/** |
||||
* 获取最新支付单号 |
||||
* @param orderNo 订单号 |
||||
* @return |
||||
*/ |
||||
public BsHltCardRecord getNewPayOrderNo(String orderNo) { |
||||
BsHltCardRecordExample example = new BsHltCardRecordExample(); |
||||
example.createCriteria() |
||||
.andOrderNoEqualTo(orderNo) |
||||
.andPayStatusEqualTo(HltCardRecordPayStatusEnum.status2.getCode()); |
||||
List<BsHltCardRecord> list = hltCardRecordMapper.selectByExample(example); |
||||
if (!list.isEmpty()) { |
||||
return list.get(0); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,152 @@ |
||||
package com.hfkj.service.hlt; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hfkj.common.exception.BaseException; |
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import com.hfkj.common.utils.DateUtil; |
||||
import com.hfkj.common.utils.RandomUtils; |
||||
import com.hfkj.entity.BsHltCardRecord; |
||||
import com.hfkj.entity.BsMerPayConfig; |
||||
import com.hfkj.entity.BsOrderRefund; |
||||
import com.hfkj.mer.BsMerPayConfigService; |
||||
import com.hfkj.model.order.OrderChildModel; |
||||
import com.hfkj.model.order.OrderModel; |
||||
import com.hfkj.service.order.BsOrderRefundService; |
||||
import com.hfkj.service.order.BsOrderService; |
||||
import com.hfkj.sysenum.hlt.HltCardRecordPayStatusEnum; |
||||
import com.hfkj.sysenum.mer.PayPlatformEnum; |
||||
import com.hfkj.sysenum.order.OrderChildStatusEnum; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.math.BigDecimal; |
||||
import java.math.BigInteger; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Objects; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* @className: HltCardRefundService |
||||
* @author: HuRui |
||||
* @date: 2024/8/21 |
||||
**/ |
||||
@Component |
||||
public class HltCardRefundService { |
||||
@Resource |
||||
private BsHltCardRecordService hltCardRecordService; |
||||
@Resource |
||||
private BsOrderRefundService orderRefundService; |
||||
@Resource |
||||
private BsMerPayConfigService merPayConfigService; |
||||
@Resource |
||||
private BsOrderService orderService; |
||||
/** |
||||
* 退款 |
||||
* @param orderRefund |
||||
* @return |
||||
*/ |
||||
public boolean refund(BsOrderRefund orderRefund) { |
||||
// 查询系统订单号
|
||||
BsHltCardRecord oldCardRecord = hltCardRecordService.getNewPayOrderNo(orderRefund.getOrderNo()); |
||||
if (oldCardRecord == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到最新的支付订单"); |
||||
} |
||||
try { |
||||
// 订单退款
|
||||
JSONObject refundObj = HuiLianTongUnionCardService.refund(orderRefund.getRefundOrderNo(), oldCardRecord.getPayOrderNo()); |
||||
if (!refundObj.getString("respCode").equals("0000")) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refundObj.getString("respMessage")); |
||||
} |
||||
JSONObject consumptionResult = HuiLianTongUnionCardService.resolveResponse(refundObj.getString("data")); |
||||
if (consumptionResult.getBoolean("success") != true) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "交易失败!"+consumptionResult.getString("message")); |
||||
} |
||||
oldCardRecord.setRefundTime(new Date()); |
||||
oldCardRecord.setPayStatus(HltCardRecordPayStatusEnum.status3.getCode()); |
||||
hltCardRecordService.update(oldCardRecord); |
||||
|
||||
orderRefund.setRefundSerialNo(consumptionResult.getString("orderId")); |
||||
orderRefundService.editData(orderRefund); |
||||
|
||||
// 重新支付金额
|
||||
BigDecimal newPayPrice = oldCardRecord.getPayPrice().subtract(orderRefund.getRefundPrice()); |
||||
if (newPayPrice.compareTo(new BigDecimal("0")) > 0) { |
||||
BsHltCardRecord newRecord = new BsHltCardRecord(); |
||||
try { |
||||
newRecord.setOrderNo(orderRefund.getOrderNo()); |
||||
newRecord.setCardNo(oldCardRecord.getCardNo()); |
||||
newRecord.setUserPhone(oldCardRecord.getUserPhone()); |
||||
newRecord.setPayOrderNo(DateUtil.date2String(new Date(), "yyMMddHHmmss") + RandomUtils.number(6, false)); |
||||
newRecord.setPayPrice(newPayPrice); |
||||
newRecord.setPayStatus(HltCardRecordPayStatusEnum.status1.getCode()); |
||||
newRecord.setExceptionStatus(false); |
||||
hltCardRecordService.create(newRecord); |
||||
|
||||
// 查询订单
|
||||
OrderModel order = orderService.getDetail(orderRefund.getOrderNo()); |
||||
// 查询平台
|
||||
BsMerPayConfig merPay = merPayConfigService.getMerPay(order.getOrderChildList().get(0).getMerId(), PayPlatformEnum.type2); |
||||
if (merPay == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户未配置支付"); |
||||
} |
||||
// 重新扣款
|
||||
String goodsDesc = ""; |
||||
String tranDesc = ""; |
||||
String businessType = "HiSen_phg_goods"; |
||||
|
||||
List<OrderChildModel> childModelList = order.getOrderChildList().stream() |
||||
.filter(o -> o.getStatus().equals(OrderChildStatusEnum.status2.getCode()) |
||||
|| o.getStatus().equals(OrderChildStatusEnum.status3.getCode())) |
||||
.collect(Collectors.toList()); |
||||
for (OrderChildModel orderChild :childModelList) { |
||||
if (StringUtils.isBlank(tranDesc)) { |
||||
tranDesc = tranDesc + orderChild.getProductName(); |
||||
} else { |
||||
tranDesc = tranDesc +","+ orderChild.getProductName(); |
||||
} |
||||
} |
||||
// 描述超过30字符,截取加省略号
|
||||
if (tranDesc.length()>30) { |
||||
tranDesc = tranDesc.substring(1,30) + "..."; |
||||
} |
||||
JSONObject consumption = HuiLianTongUnionCardService.consumption(newRecord.getPayOrderNo(), newRecord.getCardNo(), newRecord.getPayPrice(), businessType, merPay.getHltInstCode(), goodsDesc, tranDesc); |
||||
if (!consumption.getString("respCode").equals("0000")) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumption.getString("respMessage")); |
||||
} |
||||
// 响应参数
|
||||
JSONObject payConsumptionResult = HuiLianTongUnionCardService.resolveResponse(consumption.getString("data")); |
||||
if (payConsumptionResult.getBoolean("success") != true) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, payConsumptionResult.getString("message")); |
||||
} |
||||
newRecord.setPaySerialNo(consumptionResult.getString("orderId")); |
||||
newRecord.setPayTime(new Date()); |
||||
newRecord.setPayStatus(HltCardRecordPayStatusEnum.status2.getCode()); |
||||
hltCardRecordService.update(newRecord); |
||||
|
||||
} catch (BaseException e) { |
||||
newRecord.setExceptionStatus(true); |
||||
newRecord.setExceptionContent(e.getErrorMsg()); |
||||
hltCardRecordService.update(newRecord); |
||||
} catch (Exception e) { |
||||
newRecord.setExceptionStatus(true); |
||||
newRecord.setExceptionContent("未知错误"); |
||||
hltCardRecordService.update(newRecord); |
||||
} |
||||
} |
||||
|
||||
} catch (BaseException e) { |
||||
oldCardRecord.setExceptionStatus(true); |
||||
oldCardRecord.setExceptionContent(e.getErrorMsg()); |
||||
hltCardRecordService.update(oldCardRecord); |
||||
} catch (Exception e) { |
||||
oldCardRecord.setExceptionStatus(true); |
||||
oldCardRecord.setExceptionContent("未知错误"); |
||||
hltCardRecordService.update(oldCardRecord); |
||||
} |
||||
return !oldCardRecord.getExceptionStatus(); |
||||
} |
||||
} |
@ -0,0 +1,59 @@ |
||||
package com.hfkj.sysenum.fileRecords; |
||||
|
||||
|
||||
import lombok.Getter; |
||||
|
||||
import java.util.Objects; |
||||
|
||||
@Getter |
||||
public enum FileRecordsEnum { |
||||
/** |
||||
* 实物订单 |
||||
*/ |
||||
status1(1, "实物订单"), |
||||
|
||||
/** |
||||
* 虚拟订单 |
||||
*/ |
||||
status2(2, "虚拟产品订单"), |
||||
|
||||
/** |
||||
* 肯德基订单 |
||||
*/ |
||||
status3(3, "肯德基订单"), |
||||
|
||||
/** |
||||
* 星巴克订单 |
||||
*/ |
||||
status4(4, "星巴克订单"), |
||||
|
||||
/** |
||||
* 财务对账订单 |
||||
*/ |
||||
status5(5, "财务对账订单"), |
||||
|
||||
/** |
||||
* 物流订单上传订单 |
||||
*/ |
||||
status6(6, "物流订单上传订单"), |
||||
|
||||
status7(7, "物流订单下载订单"), |
||||
; |
||||
|
||||
private final int code; |
||||
|
||||
private final String name; |
||||
|
||||
|
||||
FileRecordsEnum(int code, String name) { |
||||
this.code = code; |
||||
this.name = name; |
||||
} |
||||
|
||||
public static FileRecordsEnum getData(Integer type) { |
||||
for (FileRecordsEnum ele : values()) { |
||||
if (Objects.equals(type,ele.getCode())) return ele; |
||||
} |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,38 @@ |
||||
package com.hfkj.sysenum.hlt; |
||||
|
||||
import lombok.Getter; |
||||
|
||||
/** |
||||
* |
||||
* @author hurui |
||||
*/ |
||||
@Getter |
||||
public enum HltCardRecordPayStatusEnum { |
||||
|
||||
/** |
||||
* 待支付 |
||||
*/ |
||||
status1(1, "待支付"), |
||||
|
||||
/** |
||||
* 已支付 |
||||
*/ |
||||
status2(2, "已支付"), |
||||
|
||||
/** |
||||
* 已退款 |
||||
*/ |
||||
status3(3, "已退款"), |
||||
; |
||||
|
||||
private int code; |
||||
|
||||
private String name; |
||||
|
||||
|
||||
HltCardRecordPayStatusEnum(int code, String name) { |
||||
this.code = code; |
||||
this.name = name; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,32 @@ |
||||
package com.hfkj.sysenum.order; |
||||
|
||||
import lombok.Getter; |
||||
|
||||
@Getter |
||||
public enum OrderLogisticsStatusEnum { |
||||
|
||||
statusDELIVERING("派件中" , "DELIVERING"), |
||||
|
||||
statusTRANSPORT("运输中", "TRANSPORT"), |
||||
|
||||
statusAGENT_SIGN("已代签收", "AGENT_SIGN"), |
||||
|
||||
statusSIGN("已签收", "SIGN"), |
||||
|
||||
statusACCEPT("已揽收", "ACCEPT"), |
||||
|
||||
statusFAILED("包裹异常", "FAILED"), |
||||
|
||||
statusWAIT_ACCEPT("待揽收", "WAIT_ACCEPT"), |
||||
; |
||||
|
||||
private final String code; |
||||
|
||||
private final String name; |
||||
|
||||
|
||||
OrderLogisticsStatusEnum(String name, String code) { |
||||
this.code = code; |
||||
this.name = name; |
||||
} |
||||
} |
Loading…
Reference in new issue