feat:退换各自食堂明细
This commit is contained in:
1 parent
ab1397897f
commit
8b0df2572e
10 files changed
+139
-15
No files matched your search
+16
@@ -417,6 +417,9 @@ public class HardOrderTotalController {
|
||||
// 盈利
|
||||
BigDecimal orderProfitPriceSum = BigDecimal.ZERO;
|
||||
BigDecimal orderProfitContSum = BigDecimal.ZERO;
|
||||
// 退还各自食堂金额
|
||||
BigDecimal walletReturnCanteenPriceSum = BigDecimal.ZERO;
|
||||
BigDecimal walletReturnCanteenCountSum = BigDecimal.ZERO;
|
||||
|
||||
Long lineNumber = 1L;
|
||||
for (HardDeptTotalVo v : list) {
|
||||
@@ -485,6 +488,15 @@ public class HardOrderTotalController {
|
||||
orderProfitContSum = orderProfitContSum.add(BigDecimal.valueOf(v.getOrderProfitCont()));
|
||||
v.setOrderProfitCont(BigDecimal.valueOf(v.getOrderProfitCont()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
}
|
||||
// 退还各自食堂金额
|
||||
if (ObjectUtil.isNotEmpty(v.getWalletReturnCanteenPrice())) {
|
||||
walletReturnCanteenPriceSum = walletReturnCanteenPriceSum.add(BigDecimal.valueOf(v.getWalletReturnCanteenPrice()));
|
||||
v.setWalletReturnCanteenPrice(BigDecimal.valueOf(v.getWalletReturnCanteenPrice()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getWalletReturnCanteenCount())) {
|
||||
walletReturnCanteenCountSum = walletReturnCanteenCountSum.add(BigDecimal.valueOf(v.getWalletReturnCanteenCount()));
|
||||
v.setWalletReturnCanteenCount(BigDecimal.valueOf(v.getWalletReturnCanteenCount()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).longValue());
|
||||
}
|
||||
// 批量充值
|
||||
map.put("walletPriceSum", walletPriceSum.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("walletCountSum", walletCountSum.toString());
|
||||
@@ -506,6 +518,10 @@ public class HardOrderTotalController {
|
||||
|
||||
map.put("orderProfitPriceSum", orderProfitPriceSum.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("orderProfitContSum", orderProfitContSum.toString());
|
||||
|
||||
// 退还各自食堂金额
|
||||
map.put("walletReturnCanteenPriceSum", walletReturnCanteenPriceSum.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("walletReturnCanteenCountSum", walletReturnCanteenCountSum.toString());
|
||||
}
|
||||
}
|
||||
excelWriter.fill(map, writeSheet);
|
||||
|
||||
+1
@@ -247,6 +247,7 @@ public class HardThirdPayServiceImpl implements HardThirdPayService {
|
||||
refundVo.setThirdRefundId(dto.getThirdRefundId());
|
||||
refundVo.setPlatformOrderId(dto.getPlatformOrderId());
|
||||
refundVo.setPlatformRefundId(String.valueOf(saveObj.getId()));
|
||||
refundVo.setPrice(dto.getPrice());
|
||||
baseVo.set(ThirdPayVoStatusEnum.SUCCESS);
|
||||
baseVo.setData(refundVo);
|
||||
return baseVo;
|
||||
|
||||
Binary file not shown.
+34
-12
@@ -30,7 +30,8 @@ import java.util.Map;
|
||||
public class PayTest {
|
||||
|
||||
// private final String baseUrl = "http://123.156.230.15:8089/api";
|
||||
private final String baseUrl = "http://127.0.0.1:9999";
|
||||
// private final String baseUrl = "http://127.0.0.1:9999";
|
||||
private final String baseUrl = "https://stgl.pj.gov.cn/api";
|
||||
|
||||
private final String walletInfoUrl = "/third/third-pay-api/user-wallet";
|
||||
|
||||
@@ -42,6 +43,8 @@ public class PayTest {
|
||||
|
||||
private final String detailUrl = "/third/third-pay-api/detail";
|
||||
|
||||
private final String appM4KeyProd = "4RSYZNr9bBmEeWPE";
|
||||
|
||||
@Resource
|
||||
private ThirdKeyManageService keyManageService;
|
||||
|
||||
@@ -62,12 +65,12 @@ public class PayTest {
|
||||
public void walletInfo() throws Exception {
|
||||
ThirdKeyManageEntity config = getLbConfig();
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
paramsMap.put("signPhone", LbRetailSignUtils.sm4Encrypt("17683843141", config.getFieldKey()));
|
||||
paramsMap.put("signPhone", LbRetailSignUtils.sm4Encrypt("17683843144", appM4KeyProd));
|
||||
// paramsMap.put("signPhone", "8KKubCKESDN5TlUl3i0HaQ==");
|
||||
paramsMap.put("userId", 1875049673022279681L);
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
String res = HttpRequest.post(baseUrl + walletInfoUrl).contentType("application/json").header(apiCountersign(body)).body(body).execute().body();
|
||||
String res = HttpRequest.post(baseUrl + walletInfoUrl).contentType("application/json").header(apiCountersignProd(body)).body(body).execute().body();
|
||||
PayBaseVo baseVo = JSONUtil.toBean(res, PayBaseVo.class);
|
||||
if (ObjectUtil.isNotEmpty(baseVo)) {
|
||||
PayWalletInfoVo walletInfo = JSONUtil.toBean(String.valueOf(baseVo.getData()), PayWalletInfoVo.class);
|
||||
@@ -86,7 +89,7 @@ public class PayTest {
|
||||
paramsMap.put("products", null);
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
String res = HttpRequest.post(baseUrl + walletPayUrl).contentType("application/json").header(apiCountersign(body)).body(body).execute().body();
|
||||
String res = HttpRequest.post(baseUrl + walletPayUrl).contentType("application/json").header(apiCountersignProd(body)).body(body).execute().body();
|
||||
log.info(res);
|
||||
}
|
||||
|
||||
@@ -112,7 +115,7 @@ public class PayTest {
|
||||
paramsMap.put("products", carList);
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
String res = HttpRequest.post(baseUrl + walletPayUrl).contentType("application/json").header(apiCountersign(body)).body(body).execute().body();
|
||||
String res = HttpRequest.post(baseUrl + walletPayUrl).contentType("application/json").header(apiCountersignDev(body)).body(body).execute().body();
|
||||
log.info(res);
|
||||
}
|
||||
|
||||
@@ -121,12 +124,12 @@ public class PayTest {
|
||||
public void walletRefund() throws Exception {
|
||||
ThirdKeyManageEntity config = getLbConfig();
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
paramsMap.put("platformOrderId", "1928337501121765377");
|
||||
paramsMap.put("platformOrderId", "1935235239046193154");
|
||||
paramsMap.put("thirdRefundId", System.currentTimeMillis());
|
||||
paramsMap.put("price", "300");
|
||||
paramsMap.put("price", "100");
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
String res = HttpRequest.post(baseUrl + walletRefundUrl).contentType("application/json").header(apiCountersign(body)).body(body).execute().body();
|
||||
String res = HttpRequest.post(baseUrl + walletRefundUrl).contentType("application/json").header(apiCountersignProd(body)).body(body).execute().body();
|
||||
log.info(res);
|
||||
}
|
||||
|
||||
@@ -145,7 +148,7 @@ public class PayTest {
|
||||
paramsMap.put("orderStatus", "10");
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
String res = HttpRequest.post(baseUrl + waterUrl).contentType("application/json").header(apiCountersign(body)).body(body).execute().body();
|
||||
String res = HttpRequest.post(baseUrl + waterUrl).contentType("application/json").header(apiCountersignProd(body)).body(body).execute().body();
|
||||
log.info(res);
|
||||
}
|
||||
|
||||
@@ -154,11 +157,11 @@ public class PayTest {
|
||||
public void detail() throws Exception {
|
||||
ThirdKeyManageEntity config = getLbConfig();
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
paramsMap.put("thirdOrderId", "1748586470745");
|
||||
paramsMap.put("thirdOrderId", "1750231010188");
|
||||
paramsMap.put("thirdRefundId", "");
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
String res = HttpRequest.post(baseUrl + detailUrl).contentType("application/json").header(apiCountersign(body)).body(body).execute().body();
|
||||
String res = HttpRequest.post(baseUrl + detailUrl).contentType("application/json").header(apiCountersignProd(body)).body(body).execute().body();
|
||||
log.info(res);
|
||||
}
|
||||
|
||||
@@ -173,7 +176,26 @@ public class PayTest {
|
||||
return keyManageService.get(ThirdKeyTypeEnum.LB);
|
||||
}
|
||||
|
||||
private Map<String, List<String>> apiCountersign(String body) {
|
||||
private Map<String, List<String>> apiCountersignProd(String body) {
|
||||
ThirdKeyManageEntity config = getLbConfig();
|
||||
|
||||
String appKey = "CRLAacqYWSpKMHqO";
|
||||
String appSecret = "kwziFRmR5vnxpLpn4JhzLtoKyzsThCLi";
|
||||
|
||||
String timestamp = String.valueOf(Instant.now().getEpochSecond());
|
||||
|
||||
Map<String, List<String>> headers = new HashMap<>();
|
||||
headers.put("timestamp", List.of(timestamp));
|
||||
headers.put("app-key", List.of(appKey));
|
||||
headers.put("biz-type", List.of(config.getBizType()));
|
||||
headers.put("sign", List.of());
|
||||
String signStr = String.format("%s%s%s%s%s", appKey, appSecret, config.getBizType(), timestamp, body);
|
||||
String successSignMd5 = DigestUtils.md5Hex(signStr);
|
||||
headers.put("sign", List.of(successSignMd5));
|
||||
return headers;
|
||||
}
|
||||
|
||||
private Map<String, List<String>> apiCountersignDev(String body) {
|
||||
|
||||
ThirdKeyManageEntity config = getLbConfig();
|
||||
|
||||
|
||||
+5
-3
@@ -20,7 +20,6 @@ public class WalletTransactionVo extends WalletTransactionEntity implements Base
|
||||
/**
|
||||
* 用户相关
|
||||
*/
|
||||
|
||||
private Long userId;
|
||||
|
||||
private String username;
|
||||
@@ -32,7 +31,6 @@ public class WalletTransactionVo extends WalletTransactionEntity implements Base
|
||||
/**
|
||||
* 部门相关
|
||||
*/
|
||||
|
||||
private Long deptId;
|
||||
|
||||
private String deptName;
|
||||
@@ -40,7 +38,6 @@ public class WalletTransactionVo extends WalletTransactionEntity implements Base
|
||||
/**
|
||||
* 钱包相关
|
||||
*/
|
||||
|
||||
private Long walletId;
|
||||
|
||||
private String walletCardNumber;
|
||||
@@ -99,4 +96,9 @@ public class WalletTransactionVo extends WalletTransactionEntity implements Base
|
||||
*/
|
||||
private Long lineNumber;
|
||||
|
||||
|
||||
/**
|
||||
* 审批相关
|
||||
*/
|
||||
private String processId;
|
||||
}
|
||||
+20
@@ -127,6 +127,16 @@ public class WalletTransactionController {
|
||||
return R.ok(walletTransactionService.scopePageList(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "后台退还各自食堂记录", description = "后台退还各自食堂记录")
|
||||
@PostMapping("/page-th")
|
||||
public R pageTh(@ParameterObject Page page, @RequestBody WalletTransactionDto dto) {
|
||||
dto.setBizTypes(List.of(WalletBizEnum.RETURN_CANTEEN.getCode()));
|
||||
dto.setIsFindOrder(false);
|
||||
DataScope dataScope = new DataScope();
|
||||
return R.ok(walletTransactionService.scopePageList(page, dto, dataScope));
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "分页查询复杂查询", description = "分页查询复杂查询")
|
||||
@GetMapping("/page-join")
|
||||
// TODO 这个比较公用先不加权限
|
||||
@@ -206,4 +216,14 @@ public class WalletTransactionController {
|
||||
List<WalletTransactionVo> list = walletTransactionService.scopeList(dto, DataScope.of());
|
||||
walletTransactionService.exportByTemplate(response, dto, "file/个人退款明细.xlsx", list);
|
||||
}
|
||||
|
||||
@Operation(summary = "后台退还各自食堂记录导出", description = "后台退还各自食堂记录导出")
|
||||
@PostMapping("/export-th")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletTransaction_export')")
|
||||
public void exportTh(HttpServletResponse response, @RequestBody WalletTransactionDto dto) {
|
||||
dto.setBizTypes(List.of(WalletBizEnum.RETURN_CANTEEN.getCode()));
|
||||
dto.setIsFindOrder(false);
|
||||
List<WalletTransactionVo> list = walletTransactionService.scopeList(dto, DataScope.of());
|
||||
walletTransactionService.exportByTemplate(response, dto, "file/退还各自食堂明细.xlsx", list);
|
||||
}
|
||||
}
|
||||
+2
@@ -99,6 +99,8 @@ public interface WalletTransactionMapper extends PjcloudBaseMapper<WalletTransac
|
||||
return BeanUtils.toBean(list, WalletTransactionVo.class);
|
||||
}
|
||||
|
||||
Page<WalletTransactionVo> scopeJzPageList(Page page, @Param("dto") WalletTransactionDto dto, DataScope dataScope);
|
||||
|
||||
Integer getTransactionPriceCount(@Param("month") String importTimeStr, @Param("walletId") Long walletId,
|
||||
@Param("bizType") String bizType);
|
||||
|
||||
|
||||
+5
@@ -16,6 +16,11 @@ public interface WalletTransactionService extends IService<WalletTransactionEnti
|
||||
|
||||
Page<WalletTransactionVo> scopePageList(Page page, WalletTransactionDto dto, DataScope dataScope);
|
||||
|
||||
/**
|
||||
* 记账列表
|
||||
*/
|
||||
Page<WalletTransactionVo> scopeJzPageList(Page page, WalletTransactionDto dto, DataScope dataScope);
|
||||
|
||||
List<WalletTransactionVo> scopeList(WalletTransactionDto dto, DataScope dataScope);
|
||||
|
||||
/**
|
||||
|
||||
+10
@@ -179,6 +179,16 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 记账列表
|
||||
*/
|
||||
@Override
|
||||
public Page<WalletTransactionVo> scopeJzPageList(Page page, WalletTransactionDto dto, DataScope dataScope) {
|
||||
Page<WalletTransactionVo> list = baseMapper.scopeJzPageList(page, dto, dataScope);
|
||||
disposeList(list.getRecords(), dto);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WalletTransactionVo> scopeList(WalletTransactionDto dto, DataScope dataScope) {
|
||||
List<WalletTransactionVo> list = baseMapper.scopeList(dto, dataScope);
|
||||
|
||||
+46
@@ -13,11 +13,57 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectA">
|
||||
select a.id,
|
||||
a.wallet_id,
|
||||
a.user_id,
|
||||
a.dept_id,
|
||||
a.biz_type,
|
||||
a.biz_id,
|
||||
a.title,
|
||||
a.price,
|
||||
a.balance,
|
||||
a.create_by,
|
||||
a.create_time,
|
||||
a.update_by,
|
||||
a.update_time,
|
||||
a.del_flag,
|
||||
a.tenant_id,
|
||||
</sql>
|
||||
|
||||
<sql id="whereA">
|
||||
a.del_flag = '0'
|
||||
<if test="dto.walletId != null">
|
||||
and a.wallet_id = #{dto.walletId}
|
||||
</if>
|
||||
<if test="dto.userId != null">
|
||||
and a.user_id = #{dto.userId}
|
||||
</if>
|
||||
<if test="dto.bizId != null">
|
||||
and a.biz_id = #{dto.bizId}
|
||||
</if>
|
||||
<if test="dto.bizType != null">
|
||||
and a.biz_type = #{dto.bizType}
|
||||
</if>
|
||||
<if test="dto.type != null and dto.type == 1 ">
|
||||
and a.price > 0
|
||||
</if>
|
||||
<if test="dto.type != null and dto.type == 2 ">
|
||||
and a.price < 0
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="scopeJzPageList" resultType="com.bsd.pjcloud.wallet.api.vo.transaction.WalletTransactionVo">
|
||||
<include refid="selectA"/>
|
||||
y.process_id as processId
|
||||
from wallet_transaction a
|
||||
inner join wallet_recharge_import i on i.id = a.biz_id and i.del_flag = '0'
|
||||
inner join wallet_recharge_apply y on y.id = i.apply_id and y.del_flag = '0'
|
||||
<where>
|
||||
<include refid="whereA"/>
|
||||
</where>
|
||||
order by a.create_time desc , a.id desc
|
||||
</select>
|
||||
|
||||
<select id="getTransactionPriceCount" resultType="java.lang.Integer">
|
||||
select sum(a.price)
|
||||
from wallet_transaction a
|
||||
|
||||
Reference in new issue
Block a user