Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
63ea8efded
29 files changed
+733
-154
No files matched your search
+20
-17
@@ -391,23 +391,26 @@ CREATE INDEX idx_dept_id ON wallet_recharge_apply (user_id);
|
||||
DROP TABLE IF EXISTS wallet_recharge_invoice;
|
||||
CREATE TABLE wallet_recharge_invoice
|
||||
(
|
||||
id bigint NOT NULL COMMENT '主键ID',
|
||||
apply_id bigint NOT NULL COMMENT '申请id',
|
||||
code varchar(32) NOT NULL COMMENT '发票代码(七位数)',
|
||||
time datetime DEFAULT NULL COMMENT '发票日期',
|
||||
dept_or_user varchar(64) DEFAULT NULL COMMENT '交款单位或个人',
|
||||
total_price int DEFAULT NULL COMMENT '合计人民币',
|
||||
payee_dept varchar(64) DEFAULT NULL COMMENT '收款单位',
|
||||
payee_user varchar(64) DEFAULT NULL COMMENT '收款人',
|
||||
item_json varchar(2048) DEFAULT NULL COMMENT '备注',
|
||||
remark varchar(1024) DEFAULT NULL COMMENT '备注',
|
||||
status varchar(32) DEFAULT NULL COMMENT '状态',
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
create_time datetime DEFAULT NULL COMMENT '创建时间',
|
||||
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
|
||||
update_time datetime DEFAULT NULL COMMENT '修改时间',
|
||||
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
|
||||
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
|
||||
id bigint NOT NULL COMMENT '主键ID',
|
||||
apply_user_id bigint DEFAULT NULL COMMENT '申请用户id',
|
||||
apply_dept_id bigint DEFAULT NULL COMMENT '申请用户部门id',
|
||||
apply_id bigint DEFAULT NULL COMMENT '申请id',
|
||||
code varchar(32) NOT NULL COMMENT '发票代码(七位数)',
|
||||
time datetime DEFAULT NULL COMMENT '发票日期',
|
||||
dept_or_user varchar(64) DEFAULT NULL COMMENT '交款单位或个人',
|
||||
total_price int DEFAULT NULL COMMENT '合计人民币',
|
||||
payee_dept varchar(64) DEFAULT NULL COMMENT '收款单位',
|
||||
payee_user varchar(64) DEFAULT NULL COMMENT '收款人',
|
||||
item_json varchar(2048) DEFAULT NULL COMMENT '备注',
|
||||
remark varchar(1024) DEFAULT NULL COMMENT '备注',
|
||||
status varchar(32) DEFAULT NULL COMMENT '状态',
|
||||
pic_url varchar(1024) DEFAULT NULL COMMENT '发票图片地址',
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
create_time datetime DEFAULT NULL COMMENT '创建时间',
|
||||
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
|
||||
update_time datetime DEFAULT NULL COMMENT '修改时间',
|
||||
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
|
||||
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
|
||||
+12
-5
@@ -89,12 +89,19 @@ zy:
|
||||
# callback-recognition-url: /third/third-ks/callback/recognition
|
||||
# callback-sku-url: /third/third-ks/callback/sku
|
||||
lb:
|
||||
base-url: https://elss-sit.nbcb.com.cn
|
||||
# base-url: https://elss-sit.nbcb.com.cn/h5/thirdApp
|
||||
app-id: 7da62b1a9ade473c917f573c5748081e
|
||||
app-secret: 8ffI6b+OKTmdVAt9Qo+2F/HQQMdt/d8GFia0zlJOt9I=
|
||||
# 测试环境
|
||||
# base-url: https://elss-sit.nbcb.com.cn
|
||||
# app-id: 7da62b1a9ade473c917f573c5748081e
|
||||
# app-secret: 8ffI6b+OKTmdVAt9Qo+2F/HQQMdt/d8GFia0zlJOt9I=
|
||||
# company-number: 202504673472
|
||||
# sm4-key: S67157e8aQs2tFSX
|
||||
|
||||
# 正式环境
|
||||
base-url: https://elss.nbcb.com.cn
|
||||
app-id: 528e3ca76ec34f5c9b3255ba18aee774
|
||||
app-secret: tIhDZDXWhtP6bvd0J9Q0zjIZxSkmyX+uUc87xnDTgfc=
|
||||
company-number: 202504673472
|
||||
sm4-key: S67157e8aQs2tFSX
|
||||
sm4-key: 63P839eg0uxE5aoG
|
||||
|
||||
|
||||
sms:
|
||||
|
||||
+2
-2
@@ -29,7 +29,7 @@ import java.util.Map;
|
||||
@SpringBootTest(classes = ThirdPartyApp.class)
|
||||
public class PayTest {
|
||||
|
||||
// private final String baseUrl = "http://123.156.230.15:8089/api";
|
||||
// private final String baseUrl = "http://59.202.170.152:81/api";
|
||||
// private final String baseUrl = "http://127.0.0.1:9999";
|
||||
private final String baseUrl = "https://stgl.pj.gov.cn/api";
|
||||
|
||||
@@ -67,7 +67,7 @@ public class PayTest {
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
paramsMap.put("signPhone", LbRetailSignUtils.sm4Encrypt("17683843144", appM4KeyProd));
|
||||
// paramsMap.put("signPhone", "8KKubCKESDN5TlUl3i0HaQ==");
|
||||
paramsMap.put("userId", 1875049673022279681L);
|
||||
// paramsMap.put("userId", 1875049673022279681L);
|
||||
String body = JSONUtil.toJsonStr(paramsMap);
|
||||
// 发送请求
|
||||
String res = HttpRequest.post(baseUrl + walletInfoUrl).contentType("application/json").header(apiCountersignProd(body)).body(body).execute().body();
|
||||
|
||||
@@ -306,7 +306,7 @@
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
|
||||
group by u.user_id
|
||||
<if test="_databaseId != 'mssql'">
|
||||
ORDER BY u.create_time DESC
|
||||
</if>
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import java.util.List;
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum WalletBizRechargeEnum {
|
||||
ADD("1", "添加"),
|
||||
ADD("1", "充值"),
|
||||
REDUCTION("2", "记账扣款"),
|
||||
RETURN_CANTEEN("3", "退还各自食堂"),
|
||||
;
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.bsd.pjcloud.wallet.api.constant;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 发票审核状态
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum WalletInvoiceStatusCheckEnum {
|
||||
UNCHECK("1", "未审核"),
|
||||
FOREIGN("2", "审核成功"),
|
||||
REFUND("3", "撤回"),
|
||||
;
|
||||
private final String code;
|
||||
|
||||
private final String desc;
|
||||
|
||||
|
||||
public static WalletInvoiceStatusCheckEnum descOf(String description) {
|
||||
return Arrays.stream(WalletInvoiceStatusCheckEnum.values())
|
||||
.filter(v -> ObjectUtil.equal(v.getDesc(), description))
|
||||
.findFirst().get();
|
||||
}
|
||||
|
||||
public static WalletInvoiceStatusCheckEnum codeOf(String code) {
|
||||
return Arrays.stream(WalletInvoiceStatusCheckEnum.values())
|
||||
.filter(v -> ObjectUtil.equal(v.getCode(), code))
|
||||
.findFirst().get();
|
||||
}
|
||||
}
|
||||
+14
-3
@@ -6,13 +6,18 @@ import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
// cancellation
|
||||
/**
|
||||
* 充值/申请发票状态
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum WalletRechargeInvoiceStatusEnum {
|
||||
|
||||
DEFAULT("1", "默认"),
|
||||
CANCELLATION("2", "作废"),
|
||||
UNBIND("1", "未绑定充值"),
|
||||
BINDED("2", "已绑定充值"),
|
||||
UNCHECKED("3", "未审核"),
|
||||
CHECKED("4", "审核成功"),
|
||||
CANCELLATION("5", "作废"),
|
||||
;
|
||||
private final String code;
|
||||
|
||||
@@ -24,4 +29,10 @@ public enum WalletRechargeInvoiceStatusEnum {
|
||||
.findFirst().get();
|
||||
}
|
||||
|
||||
public static WalletRechargeInvoiceStatusEnum codeOf(String code) {
|
||||
return Arrays.stream(WalletRechargeInvoiceStatusEnum.values())
|
||||
.filter(v -> ObjectUtil.equal(v.getCode(), code))
|
||||
.findFirst().get();
|
||||
}
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.bsd.pjcloud.wallet.api.dto.recharge;
|
||||
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeInvoiceVo;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.math3.optim.nonlinear.scalar.LineSearch;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 充值记录绑定发票
|
||||
*/
|
||||
@Data
|
||||
public class WalletRechargeBindInvoiceDto extends WalletRechargeInvoiceVo {
|
||||
|
||||
/**
|
||||
* 充值/扣款申请id
|
||||
*/
|
||||
private Long applyId;
|
||||
|
||||
/**
|
||||
* 申请人
|
||||
*/
|
||||
private List<String> userIds;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime[] createTimeList;
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.bsd.pjcloud.wallet.api.dto.recharge;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WalletRechargeSaveTopupDto {
|
||||
|
||||
/**
|
||||
* 充值类型
|
||||
*/
|
||||
private String bizType;
|
||||
|
||||
/**
|
||||
* 发票id
|
||||
*/
|
||||
private Long invoiceId;
|
||||
|
||||
}
|
||||
+6
@@ -40,6 +40,12 @@ public class WalletRechargeApplyEntity extends Model<WalletRechargeApplyEntity>
|
||||
@Schema(description = "流程id")
|
||||
private String processId;
|
||||
|
||||
/**
|
||||
* 绑定发票id
|
||||
*/
|
||||
@Schema(description = "绑定发票id")
|
||||
private Long invoiceId;
|
||||
|
||||
/**
|
||||
* 流程状态
|
||||
*/
|
||||
|
||||
+6
@@ -49,6 +49,12 @@ public class WalletRechargeImportEntity extends Model<WalletRechargeImportEntity
|
||||
@Schema(description = "申请id")
|
||||
private Long applyId;
|
||||
|
||||
/**
|
||||
* 发票id
|
||||
*/
|
||||
@Schema(description = "发票id")
|
||||
private Long invoiceId;
|
||||
|
||||
/**
|
||||
* 导入前的金额
|
||||
*/
|
||||
|
||||
+26
-2
@@ -27,6 +27,18 @@ public class WalletRechargeInvoiceEntity extends Model<WalletRechargeInvoiceEnti
|
||||
@Schema(description = "主键ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 申请id
|
||||
*/
|
||||
@Schema(description = "申请id")
|
||||
private Long applyUserId;
|
||||
|
||||
/**
|
||||
* 申请id
|
||||
*/
|
||||
@Schema(description = "申请id")
|
||||
private Long applyDeptId;
|
||||
|
||||
/**
|
||||
* 申请id
|
||||
*/
|
||||
@@ -52,9 +64,9 @@ public class WalletRechargeInvoiceEntity extends Model<WalletRechargeInvoiceEnti
|
||||
private String deptOrUser;
|
||||
|
||||
/**
|
||||
* 合计人民币
|
||||
* 合计人民币(分)
|
||||
*/
|
||||
@Schema(description = "合计人民币")
|
||||
@Schema(description = "合计人民币(分)")
|
||||
private Integer totalPrice;
|
||||
|
||||
/**
|
||||
@@ -87,6 +99,18 @@ public class WalletRechargeInvoiceEntity extends Model<WalletRechargeInvoiceEnti
|
||||
@Schema(description = "状态")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 发票审核状态
|
||||
*/
|
||||
// @Schema(description = "发票审核状态")
|
||||
// private String invoiceStatus;
|
||||
|
||||
/**
|
||||
* 发票图片地址(不盖章)
|
||||
*/
|
||||
@Schema(description = "发票图片地址(不盖章)")
|
||||
private String picUrl;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
|
||||
+5
@@ -40,4 +40,9 @@ public class WalletRechargeApplyVo extends WalletRechargeApplyEntity implements
|
||||
*/
|
||||
private Boolean isCheckUser = false;
|
||||
|
||||
/**
|
||||
* 总金额
|
||||
*/
|
||||
private Integer totalPrice;
|
||||
|
||||
}
|
||||
+1
-1
@@ -6,7 +6,7 @@ import lombok.Data;
|
||||
* 充值/扣款申请发票记录款项
|
||||
*/
|
||||
@Data
|
||||
public class WalletRechargeInvoiceEntityItemVo {
|
||||
public class WalletRechargeInvoiceItemVo {
|
||||
|
||||
/**
|
||||
* 款项内容
|
||||
+1
-1
@@ -4,7 +4,7 @@ import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeInvoiceEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WalletRechargeInvoiceEntityVo extends WalletRechargeInvoiceEntity {
|
||||
public class WalletRechargeInvoiceVo extends WalletRechargeInvoiceEntity {
|
||||
|
||||
private String totalPriceCnStr;
|
||||
|
||||
+18
-4
@@ -6,12 +6,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.excel.annotation.RequestExcel;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeApplyDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeImportDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeSaveTopupDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.excel.WalletRechargeExcelDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeApplyEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.excel.WalletRechargeByApplyExcelVo;
|
||||
@@ -48,13 +50,19 @@ public class WalletRechargeApplyController {
|
||||
}
|
||||
/* ************************************* start callback start ************************************* */
|
||||
|
||||
@PostMapping("/save-topup")
|
||||
@Operation(summary = "新增充值")
|
||||
public R comparePageJoin(@RequestBody WalletRechargeSaveTopupDto dto) {
|
||||
walletRechargeApplyService.saveTopup(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@GetMapping("/compare-page-join")
|
||||
@Operation(summary = "批量充值/扣款记录")
|
||||
public R comparePageJoin(@ParameterObject Page page, @ParameterObject WalletRechargeApplyDto dto) {
|
||||
return R.ok(walletTransactionComposeService.pageJoin(page, dto));
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "提交申请", description = "提交申请")
|
||||
@SysLog("提交申请")
|
||||
@GetMapping("/apply")
|
||||
@@ -86,7 +94,8 @@ public class WalletRechargeApplyController {
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRechargeApply_view')")
|
||||
public R getWalletRechargeApplyPage(@ParameterObject Page page, @ParameterObject WalletRechargeApplyDto dto) {
|
||||
dto.setIsFindCheckUser(true);
|
||||
return R.ok(walletRechargeApplyService.scopePageList(page, dto));
|
||||
DataScope dataScope = new DataScope();
|
||||
return R.ok(walletRechargeApplyService.scopePageList(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@@ -141,8 +150,13 @@ public class WalletRechargeApplyController {
|
||||
}
|
||||
|
||||
@PostMapping("/read-excel")
|
||||
public R readExcel(@RequestExcel List<WalletRechargeExcelDto> excelVOList, BindingResult bindingResult) {
|
||||
return walletRechargeApplyService.readExcel(excelVOList, bindingResult);
|
||||
public R readExcel(@RequestExcel List<WalletRechargeExcelDto> excelVOList, BindingResult bindingResult, @RequestParam(required = false) String bizType) {
|
||||
return walletRechargeApplyService.readExcel(excelVOList, bindingResult, bizType);
|
||||
}
|
||||
|
||||
@PostMapping("/read-topup-excel")
|
||||
public R readTopupExcel(@RequestExcel List<WalletRechargeExcelDto> excelVOList, BindingResult bindingResult) {
|
||||
return walletRechargeApplyService.readTopupExcel(excelVOList, bindingResult);
|
||||
}
|
||||
|
||||
/* ************************************* start excel start ************************************* */
|
||||
|
||||
+28
-11
@@ -2,14 +2,16 @@ package com.bsd.pjcloud.wallet.controller.recharge;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeBindInvoiceDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeInvoiceEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeInvoiceEntityVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeInvoiceVo;
|
||||
import com.bsd.pjcloud.wallet.service.WalletRechargeInvoiceService;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
@@ -21,7 +23,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 充值/扣款申请发票记录
|
||||
@@ -37,23 +38,38 @@ public class WalletRechargeInvoiceController {
|
||||
|
||||
@GetMapping("/get-invoice")
|
||||
@Operation(summary = "批量充值/扣款发票信息")
|
||||
public R<WalletRechargeInvoiceEntityVo> getInvoice(@RequestParam Long id) {
|
||||
public R<WalletRechargeInvoiceVo> getInvoice(@RequestParam Long id) {
|
||||
return R.ok(walletRechargeInvoiceService.getInvoice(id));
|
||||
}
|
||||
|
||||
@PostMapping("/bind-invoice")
|
||||
@Operation(summary = "绑定发票")
|
||||
public R bindInvoice(@Valid @RequestBody WalletRechargeBindInvoiceDto dto) {
|
||||
walletRechargeInvoiceService.bindInvoice(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "下拉", description = "下拉")
|
||||
@GetMapping("/select")
|
||||
public R select(@ParameterObject Page page, @ParameterObject WalletRechargeBindInvoiceDto dto) {
|
||||
DataScope dataScope = null;
|
||||
return R.ok(walletRechargeInvoiceService.scopePageList(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRechargeInvoice_view')")
|
||||
public R getWalletRechargeInvoicePage(@ParameterObject Page page, @ParameterObject WalletRechargeInvoiceEntity walletRechargeInvoice) {
|
||||
LambdaQueryWrapper<WalletRechargeInvoiceEntity> wrapper = Wrappers.lambdaQuery();
|
||||
return R.ok(walletRechargeInvoiceService.page(page, wrapper));
|
||||
public R getWalletRechargeInvoicePage(@ParameterObject Page page, @ParameterObject WalletRechargeBindInvoiceDto dto) {
|
||||
DataScope dataScope = DataScope.of();
|
||||
dataScope.setScopeDeptName("apply_dept_id");
|
||||
return R.ok(walletRechargeInvoiceService.scopePageList(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRechargeInvoice_view')")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(walletRechargeInvoiceService.getById(id));
|
||||
return R.ok(walletRechargeInvoiceService.joinById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增充值/扣款申请发票记录", description = "新增充值/扣款申请发票记录")
|
||||
@@ -68,8 +84,8 @@ public class WalletRechargeInvoiceController {
|
||||
@SysLog("修改充值/扣款申请发票记录")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRechargeInvoice_edit')")
|
||||
public R updateById(@RequestBody WalletRechargeInvoiceEntity walletRechargeInvoice) {
|
||||
return R.ok(walletRechargeInvoiceService.updateById(walletRechargeInvoice));
|
||||
public R updateById(@RequestBody WalletRechargeInvoiceEntity dto) {
|
||||
return R.ok(walletRechargeInvoiceService.edit(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id删除充值/扣款申请发票记录", description = "通过id删除充值/扣款申请发票记录")
|
||||
@@ -77,7 +93,8 @@ public class WalletRechargeInvoiceController {
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRechargeInvoice_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(walletRechargeInvoiceService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
walletRechargeInvoiceService.delByIds(CollUtil.toList(ids));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
|
||||
+1
@@ -21,6 +21,7 @@ public interface WalletForeignMapper extends PjcloudBaseMapper<WalletForeignEnti
|
||||
MPJLambdaWrapper<WalletForeignEntity> wrapper = new MPJLambdaWrapper<WalletForeignEntity>()
|
||||
.selectAll(WalletForeignEntity.class)
|
||||
.eqIfExists(WalletForeignEntity::getProcessStatus, dto.getProcessStatus())
|
||||
.eqIfExists(WalletForeignEntity::getUserId, dto.getUserId())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletForeignEntity::getDeptId, dto.getDeptIds())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletForeignEntity::getUserId, dto.getUserIds())
|
||||
.ne(!dto.getIsFindUsed(), WalletForeignEntity::getCount, WalletForeignEntity::getUseCount)
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ public interface WalletStrideMapper extends PjcloudBaseMapper<WalletStrideEntity
|
||||
MPJLambdaWrapper<WalletStrideEntity> wrapper = new MPJLambdaWrapper<WalletStrideEntity>()
|
||||
.selectAll(WalletStrideEntity.class)
|
||||
.eqIfExists(WalletStrideEntity::getProcessStatus, dto.getProcessStatus())
|
||||
.eqIfExists(WalletStrideEntity::getUserId, dto.getUserId())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletStrideEntity::getDeptId, dto.getDeptIds())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletStrideEntity::getUserId, dto.getUserIds())
|
||||
.ne(!dto.getIsFindUsed(), WalletForeignEntity::getCount, WalletForeignEntity::getUseCount)
|
||||
|
||||
+8
-27
@@ -16,37 +16,17 @@ import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeApplyVo;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface WalletRechargeApplyMapper extends PjcloudBaseMapper<WalletRechargeApplyEntity> {
|
||||
|
||||
default Page<WalletRechargeApplyVo> pageJoin(Page page, WalletRechargeApplyDto dto) {
|
||||
MPJLambdaWrapper<WalletRechargeApplyEntity> wrapper = new MPJLambdaWrapper<WalletRechargeApplyEntity>()
|
||||
.selectAll(WalletRechargeApplyEntity.class)
|
||||
.selectAs(WalletTypeEntity::getName, WalletRechargeApplyVo::getWalletTypeName)
|
||||
.selectAs(WalletTypeEntity::getUniqueCode, WalletRechargeApplyVo::getWalletTypeUniqueCode)
|
||||
.leftJoin(WalletTypeEntity.class, WalletTypeEntity::getId, WalletRechargeApplyEntity::getWalletTypeId)
|
||||
.eqIfExists(WalletRechargeApplyEntity::getWalletTypeId, dto.getWalletTypeId())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletManageEntity::getUserId, dto.getUserIds())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getWalletTypeIds()), WalletManageEntity::getWalletTypeId, dto.getWalletTypeIds())
|
||||
.between(
|
||||
ObjectUtil.isNotEmpty(dto.getCreateTimeList()),
|
||||
WalletRechargeApplyEntity::getCreateTime,
|
||||
ObjectUtil.isNotEmpty(dto.getCreateTimeList()) ? dto.getCreateTimeList()[0] : null,
|
||||
ObjectUtil.isNotEmpty(dto.getCreateTimeList()) ? dto.getCreateTimeList()[1] : null
|
||||
)
|
||||
.between(
|
||||
ObjectUtil.isNotEmpty(dto.getProcessTimeList()),
|
||||
WalletRechargeApplyEntity::getProcessTime,
|
||||
ObjectUtil.isNotEmpty(dto.getProcessTimeList()) ? dto.getProcessTimeList()[0] : null,
|
||||
ObjectUtil.isNotEmpty(dto.getProcessTimeList()) ? dto.getProcessTimeList()[1] : null
|
||||
)
|
||||
.orderByDesc(WalletRechargeApplyEntity::getCreateTime)
|
||||
.orderByDesc(WalletRechargeApplyEntity::getId);
|
||||
return selectJoinPage(page, WalletRechargeApplyVo.class, wrapper);
|
||||
}
|
||||
|
||||
Page<WalletRechargeApplyVo> scopePageList(Page page, @Param("dto") WalletRechargeApplyDto dto, DataScope dataScope);
|
||||
|
||||
Page<WalletRechargeApplyVo> pageJoin(Page page, @Param("dto") WalletRechargeApplyDto dto, DataScope dataScope);
|
||||
|
||||
default Page<WalletRechargeApplyVo> scopePageList(Page page, WalletRechargeApplyDto dto) {
|
||||
LambdaQueryWrapper<WalletRechargeApplyEntity> wrapper = new LambdaQueryWrapper<WalletRechargeApplyEntity>()
|
||||
@@ -71,8 +51,9 @@ public interface WalletRechargeApplyMapper extends PjcloudBaseMapper<WalletRecha
|
||||
wrapper.orderByDesc(WalletRechargeApplyEntity::getProcessTime)
|
||||
.orderByDesc(WalletRechargeApplyEntity::getId);
|
||||
} else {
|
||||
wrapper.orderByDesc(WalletRechargeApplyEntity::getCreateTime)
|
||||
.orderByDesc(WalletRechargeApplyEntity::getId);
|
||||
wrapper.orderByDesc(WalletRechargeApplyEntity::getApplyTime)
|
||||
.orderByDesc(WalletRechargeApplyEntity::getCreateTime);
|
||||
// wrapper.orderByDesc(WalletRechargeApplyEntity::getCreateTime);
|
||||
}
|
||||
|
||||
Page list = selectPageByScope(page, wrapper, DataScope.of());
|
||||
|
||||
+15
@@ -1,8 +1,13 @@
|
||||
package com.bsd.pjcloud.wallet.mapper.recharge;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeBindInvoiceDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeInvoiceEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeInvoiceVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface WalletRechargeInvoiceMapper extends PjcloudBaseMapper<WalletRechargeInvoiceEntity> {
|
||||
@@ -11,4 +16,14 @@ public interface WalletRechargeInvoiceMapper extends PjcloudBaseMapper<WalletRec
|
||||
* 查询所有数量包括删除
|
||||
*/
|
||||
Long selectAllCount();
|
||||
|
||||
/**
|
||||
* 分页权限查询
|
||||
*/
|
||||
Page<WalletRechargeInvoiceVo> scopePageList(Page page, @Param("dto") WalletRechargeBindInvoiceDto dto, DataScope dataScope);
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
*/
|
||||
WalletRechargeInvoiceVo joinById(@Param("id") Long id);
|
||||
}
|
||||
+1
@@ -2,6 +2,7 @@ package com.bsd.pjcloud.wallet.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeApplyDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeSaveTopupDto;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeApplyCompareAceVo;
|
||||
|
||||
public interface WalletRechargeApplyComposeService {
|
||||
|
||||
+16
-4
@@ -3,9 +3,11 @@ package com.bsd.pjcloud.wallet.service;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeApplyDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeImportDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeSaveTopupDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.excel.WalletRechargeExcelDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeApplyEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeApplyVo;
|
||||
@@ -17,6 +19,11 @@ import java.util.List;
|
||||
|
||||
public interface WalletRechargeApplyService extends IService<WalletRechargeApplyEntity> {
|
||||
|
||||
/**
|
||||
* 新增充值
|
||||
*/
|
||||
void saveTopup(WalletRechargeSaveTopupDto dto);
|
||||
|
||||
void create(WalletRechargeApplyEntity dto);
|
||||
|
||||
Boolean edit(WalletRechargeApplyDto dto);
|
||||
@@ -26,9 +33,9 @@ public interface WalletRechargeApplyService extends IService<WalletRechargeApply
|
||||
*/
|
||||
void delByIds(ArrayList<Long> list);
|
||||
|
||||
Page<WalletRechargeApplyVo> pageJoin(Page page, WalletRechargeApplyDto dto);
|
||||
Page<WalletRechargeApplyVo> pageJoin(Page page, WalletRechargeApplyDto dto, DataScope dataScope);
|
||||
|
||||
Page<WalletRechargeApplyVo> scopePageList(Page page, WalletRechargeApplyDto dto);
|
||||
Page<WalletRechargeApplyVo> scopePageList(Page page, WalletRechargeApplyDto dto, DataScope dataScope);
|
||||
|
||||
/**
|
||||
* 提交申请
|
||||
@@ -41,9 +48,14 @@ public interface WalletRechargeApplyService extends IService<WalletRechargeApply
|
||||
void cancelApply(WalletRechargeApplyDto dto);
|
||||
|
||||
/**
|
||||
* 读取excel内容
|
||||
* 读取记账扣款、退回各自食堂excel内容
|
||||
*/
|
||||
R readExcel(List<WalletRechargeExcelDto> excelVOList, BindingResult bindingResult);
|
||||
R readExcel(List<WalletRechargeExcelDto> excelVOList, BindingResult bindingResult, String bizType);
|
||||
|
||||
/**
|
||||
* 读取充值excel内容
|
||||
*/
|
||||
R readTopupExcel(List<WalletRechargeExcelDto> excelVOList, BindingResult bindingResult);
|
||||
|
||||
/**
|
||||
* 审批回调
|
||||
|
||||
+39
-2
@@ -1,18 +1,55 @@
|
||||
package com.bsd.pjcloud.wallet.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeBindInvoiceDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeInvoiceEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeInvoiceEntityVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeInvoiceVo;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public interface WalletRechargeInvoiceService extends IService<WalletRechargeInvoiceEntity> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
Page<WalletRechargeInvoiceVo> scopePageList(Page page, WalletRechargeBindInvoiceDto dto, DataScope dataScope);
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
*/
|
||||
WalletRechargeInvoiceVo joinById(Long id);
|
||||
|
||||
/**
|
||||
* 批量充值/扣款发票信息
|
||||
*/
|
||||
WalletRechargeInvoiceEntityVo getInvoice(Long id);
|
||||
WalletRechargeInvoiceVo getInvoice(Long id);
|
||||
|
||||
/**
|
||||
* 获取发票代码
|
||||
*/
|
||||
String getInvoiceCode();
|
||||
|
||||
/**
|
||||
* 绑定发票
|
||||
*/
|
||||
void bindInvoice(@Valid WalletRechargeBindInvoiceDto dto);
|
||||
|
||||
/**
|
||||
* 创建基础发票
|
||||
*/
|
||||
WalletRechargeInvoiceEntity createBaseInvoice(PjcloudUser loginUser, Integer totalPrice);
|
||||
|
||||
/**
|
||||
* 编辑发票
|
||||
*/
|
||||
Long edit(WalletRechargeInvoiceEntity dto);
|
||||
|
||||
/**
|
||||
* 批量删除发票
|
||||
*/
|
||||
void delByIds(ArrayList<Long> list);
|
||||
}
|
||||
+123
-22
@@ -21,6 +21,7 @@ import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.tenant.TenantContextHolder;
|
||||
import com.bsd.pjcloud.common.excel.vo.ErrorMessage;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
@@ -33,16 +34,19 @@ import com.bsd.pjcloud.flow.task.dto.TaskDto;
|
||||
import com.bsd.pjcloud.flow.task.dto.TaskParamDto;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletBizRechargeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletRechargeInvoiceStatusEnum;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletManageDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletTypeDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeApplyDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeImportDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeSaveTopupDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.excel.WalletRechargeExcelDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeApplyEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeImportEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeInvoiceEntity;
|
||||
import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeApplyVo;
|
||||
@@ -52,6 +56,7 @@ import com.bsd.pjcloud.wallet.mapper.WalletManageMapper;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletTransactionMapper;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper;
|
||||
import com.bsd.pjcloud.wallet.mapper.recharge.WalletRechargeApplyMapper;
|
||||
import com.bsd.pjcloud.wallet.mapper.recharge.WalletRechargeInvoiceMapper;
|
||||
import com.bsd.pjcloud.wallet.service.*;
|
||||
import com.bsd.pjcloud.wallet.utils.flow.FlowUtil;
|
||||
import com.bsd.pjcloud.wallet.utils.flow.dto.WalletRechargeApplyFlowDto;
|
||||
@@ -59,6 +64,8 @@ import com.bsd.pjcloud.wallet.utils.flow.dto.WalletRechargeApplyFlowDto;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.BindingResult;
|
||||
@@ -92,6 +99,7 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
private final WalletTransactionMapper walletTransactionMapper;
|
||||
private final WalletManageMapper walletManageMapper;
|
||||
private final WalletTypeMapper walletTypeMapper;
|
||||
private final WalletRechargeInvoiceService walletRechargeInvoiceService;
|
||||
|
||||
private final RemoteUserService userService;
|
||||
private final RemoteDeptService deptService;
|
||||
@@ -99,6 +107,46 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
|
||||
private final FlowUtil flowUtil;
|
||||
|
||||
/**
|
||||
* 新增充值
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveTopup(WalletRechargeSaveTopupDto dto) {
|
||||
// 查询一下发票记录
|
||||
WalletRechargeInvoiceEntity invoice = walletRechargeInvoiceService.getById(dto.getInvoiceId());
|
||||
if (ObjectUtil.isEmpty(invoice)) throw new RuntimeException("发票记录不存在");
|
||||
if (ObjectUtil.isNotEmpty(invoice.getApplyId())) throw new RuntimeException("该发票已被绑定");
|
||||
|
||||
|
||||
WalletRechargeApplyEntity apply = new WalletRechargeApplyEntity();
|
||||
apply.setInvoiceId(invoice.getId());
|
||||
apply.setUserId(invoice.getApplyUserId());
|
||||
apply.setBizType(dto.getBizType());
|
||||
apply.setWalletTypeId(null);
|
||||
apply.setDeptId(invoice.getApplyDeptId());
|
||||
apply.setImportTime(invoice.getCreateTime().toLocalDate());
|
||||
apply.setRemark(invoice.getRemark());
|
||||
baseMapper.insert(apply);
|
||||
// 更新import记录表的applyId
|
||||
List<WalletRechargeImportEntity> list = rechargeImportService.list(new LambdaQueryWrapper<WalletRechargeImportEntity>().eq(WalletRechargeImportEntity::getInvoiceId, invoice.getId()).isNull(WalletRechargeImportEntity::getApplyId));
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
List<WalletRechargeImportEntity> updateObjList = list.stream().map(v -> {
|
||||
WalletRechargeImportEntity item = new WalletRechargeImportEntity();
|
||||
item.setId(v.getId());
|
||||
item.setApplyId(apply.getId());
|
||||
return item;
|
||||
}).toList();
|
||||
rechargeImportService.updateBatchById(updateObjList);
|
||||
}
|
||||
// 更新发票状态
|
||||
WalletRechargeInvoiceEntity updateObj = new WalletRechargeInvoiceEntity();
|
||||
updateObj.setId(invoice.getId());
|
||||
updateObj.setStatus(WalletRechargeInvoiceStatusEnum.BINDED.getCode());
|
||||
updateObj.setApplyId(apply.getId());
|
||||
walletRechargeInvoiceService.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(WalletRechargeApplyEntity dto) {
|
||||
PjcloudUser loginUser = SecurityUtils.getUser();
|
||||
@@ -145,6 +193,10 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
dto.setProcessInstanceIdList(List.of(detail.getProcessId()));
|
||||
flowEngineService.stopProcessInstance(dto).getData();
|
||||
}
|
||||
// 如果有发票要删除一下
|
||||
if (ObjectUtil.isNotEmpty(detail.getInvoiceId())) {
|
||||
walletRechargeInvoiceService.removeById(detail.getInvoiceId());
|
||||
}
|
||||
// 删除申请记录
|
||||
baseMapper.deleteById(v);
|
||||
// 删除申请记录条目
|
||||
@@ -153,8 +205,8 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletRechargeApplyVo> pageJoin(Page page, WalletRechargeApplyDto dto) {
|
||||
Page<WalletRechargeApplyVo> list = baseMapper.pageJoin(page, dto);
|
||||
public Page<WalletRechargeApplyVo> pageJoin(Page page, WalletRechargeApplyDto dto, DataScope dataScope) {
|
||||
Page<WalletRechargeApplyVo> list = baseMapper.pageJoin(page, dto, dataScope);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletRechargeApplyVo::getUserId).distinct().toList();
|
||||
@@ -178,8 +230,8 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
|
||||
|
||||
@Override
|
||||
public Page<WalletRechargeApplyVo> scopePageList(Page page, WalletRechargeApplyDto dto) {
|
||||
Page<WalletRechargeApplyVo> list = baseMapper.scopePageList(page, dto);
|
||||
public Page<WalletRechargeApplyVo> scopePageList(Page page, WalletRechargeApplyDto dto, DataScope dataScope) {
|
||||
Page<WalletRechargeApplyVo> list = baseMapper.scopePageList(page, dto, dataScope);
|
||||
disposeList(list.getRecords(), dto);
|
||||
return list;
|
||||
}
|
||||
@@ -197,7 +249,7 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
}
|
||||
// 判断之前有没有在审核的
|
||||
if (isCheckData(detail.getUserId())) {
|
||||
throw new RuntimeException("最多提交3个申请,请勿重复提交");
|
||||
throw new RuntimeException("最多提交10个申请,请勿重复提交");
|
||||
}
|
||||
// 查询用户
|
||||
UserInfo user = userService.getInnerByUserId(detail.getUserId()).getData();
|
||||
@@ -234,6 +286,13 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
updateObj.setProcessStatus(TaskCheckStatusEnum.PADDING.getCode());
|
||||
updateObj.setApplyTime(LocalDateTime.now());
|
||||
baseMapper.updateById(updateObj);
|
||||
// 如果有绑定的发票
|
||||
if (ObjectUtil.isNotEmpty(detail.getInvoiceId())) {
|
||||
WalletRechargeInvoiceEntity invoiceUpdate = new WalletRechargeInvoiceEntity();
|
||||
invoiceUpdate.setId(detail.getInvoiceId());
|
||||
invoiceUpdate.setStatus(WalletRechargeInvoiceStatusEnum.UNCHECKED.getCode());
|
||||
walletRechargeInvoiceService.updateById(invoiceUpdate);
|
||||
}
|
||||
// 更新之前的总金额
|
||||
getSelf().updateBeforePrice(detail);
|
||||
}
|
||||
@@ -250,13 +309,57 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R readExcel(List<WalletRechargeExcelDto> list, BindingResult bindingResult) {
|
||||
public R readExcel(List<WalletRechargeExcelDto> excelVOList, BindingResult bindingResult, String bizType) {
|
||||
ImmutablePair<List<ErrorMessage>, List<WalletRechargeExcelDto>> pair = validateExcelData(excelVOList, bindingResult);
|
||||
List<ErrorMessage> errorMessages = pair.getLeft();
|
||||
List<WalletRechargeExcelDto> list = pair.getRight();
|
||||
if (ObjectUtil.isNotEmpty(errorMessages)) return R.failed(errorMessages);
|
||||
PjcloudUser loginUser = SecurityUtils.getUser();
|
||||
WalletRechargeApplyEntity insertObj = new WalletRechargeApplyEntity();
|
||||
insertObj.setDeptId(loginUser.getDeptId());
|
||||
insertObj.setUserId(loginUser.getId());
|
||||
insertObj.setBizType(bizType);
|
||||
int i = baseMapper.insert(insertObj);
|
||||
if (i <= 0) {
|
||||
throw new RuntimeException("导入失败");
|
||||
}
|
||||
List<WalletRechargeImportEntity> batchSaveList = list.stream().map(v -> WalletRechargeImportEntity.builder().price(v.getPriceNumber()).userId(v.getUserId()).userDeptId(v.getUserDeptId()).build()).toList();
|
||||
batchSaveList.forEach(v -> v.setApplyId(insertObj.getId()));
|
||||
rechargeImportService.saveBatch(batchSaveList);
|
||||
return R.ok(null, "导入成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取充值excel内容
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R readTopupExcel(List<WalletRechargeExcelDto> excelVOList, BindingResult bindingResult) {
|
||||
ImmutablePair<List<ErrorMessage>, List<WalletRechargeExcelDto>> pair = validateExcelData(excelVOList, bindingResult);
|
||||
List<ErrorMessage> errorMessages = pair.getLeft();
|
||||
List<WalletRechargeExcelDto> list = pair.getRight();
|
||||
if (ObjectUtil.isNotEmpty(errorMessages)) return R.failed(errorMessages);
|
||||
PjcloudUser loginUser = SecurityUtils.getUser();
|
||||
// 先创建发票
|
||||
Integer totalPrice = list.stream().map(WalletRechargeExcelDto::getPriceNumber).reduce(Integer::sum).orElse(0);
|
||||
WalletRechargeInvoiceEntity invoice = walletRechargeInvoiceService.createBaseInvoice(loginUser, totalPrice);
|
||||
if (ObjectUtil.isEmpty(invoice)) throw new RuntimeException("导入失败");
|
||||
// 导入数据
|
||||
List<WalletRechargeImportEntity> batchSaveList = list.stream().map(v -> WalletRechargeImportEntity.builder().price(v.getPriceNumber()).userId(v.getUserId()).userDeptId(v.getUserDeptId()).invoiceId(invoice.getId()).build()).toList();
|
||||
rechargeImportService.saveBatch(batchSaveList);
|
||||
return R.ok(null, "导入成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验充值/扣款excel的数据
|
||||
*/
|
||||
public ImmutablePair<List<ErrorMessage>, List<WalletRechargeExcelDto>> validateExcelData(List<WalletRechargeExcelDto> list, BindingResult bindingResult) {
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
return R.failed();
|
||||
throw new RuntimeException("读取excel数据错误");
|
||||
}
|
||||
list = list.stream().filter(v -> !ObjectUtil.isAllEmpty(v.getUsername(), v.getUserMobile(), v.getPrice())).toList();
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
return R.failed();
|
||||
throw new RuntimeException("读取excel数据错误");
|
||||
}
|
||||
List<ErrorMessage> errorMessageList = (List<ErrorMessage>) bindingResult.getTarget();
|
||||
List<String> usernameList = list.stream().map(WalletRechargeExcelDto::getUsername).toList();
|
||||
@@ -306,20 +409,9 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(errorMessageList)) {
|
||||
return R.failed(errorMessageList);
|
||||
return ImmutablePair.of(errorMessageList, null);
|
||||
}
|
||||
PjcloudUser loginUser = SecurityUtils.getUser();
|
||||
WalletRechargeApplyEntity insertObj = new WalletRechargeApplyEntity();
|
||||
insertObj.setDeptId(loginUser.getDeptId());
|
||||
insertObj.setUserId(loginUser.getId());
|
||||
int i = baseMapper.insert(insertObj);
|
||||
if (i <= 0) {
|
||||
throw new RuntimeException("导入失败");
|
||||
}
|
||||
List<WalletRechargeImportEntity> batchSaveList = list.stream().map(v -> WalletRechargeImportEntity.builder().price(v.getPriceNumber()).userId(v.getUserId()).userDeptId(v.getUserDeptId()).build()).toList();
|
||||
batchSaveList.forEach(v -> v.setApplyId(insertObj.getId()));
|
||||
rechargeImportService.saveBatch(batchSaveList);
|
||||
return R.ok(null, "导入成功");
|
||||
return ImmutablePair.of(null, list);
|
||||
}
|
||||
|
||||
/* ************************************* end excel end ************************************* */
|
||||
@@ -346,6 +438,15 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
Boolean isConsent = flowUtil.isConsent(dto);
|
||||
String processStatus = isConsent ? TaskCheckStatusEnum.RESULT.getCode() : TaskCheckStatusEnum.REJECT.getCode();
|
||||
baseMapper.updateById(WalletRechargeApplyEntity.builder().id(detail.getId()).processTime(LocalDateTime.now()).processStatus(processStatus).build());
|
||||
|
||||
// 如果有绑定的发票
|
||||
if (ObjectUtil.isNotEmpty(detail.getInvoiceId())) {
|
||||
WalletRechargeInvoiceEntity invoiceUpdate = new WalletRechargeInvoiceEntity();
|
||||
invoiceUpdate.setId(detail.getInvoiceId());
|
||||
invoiceUpdate.setStatus(WalletRechargeInvoiceStatusEnum.CHECKED.getCode());
|
||||
walletRechargeInvoiceService.updateById(invoiceUpdate);
|
||||
}
|
||||
|
||||
if (isConsent) {
|
||||
List<WalletRechargeImportEntity> importList = rechargeImportService.list(new LambdaQueryWrapper<WalletRechargeImportEntity>().eq(WalletRechargeImportEntity::getApplyId, detail.getId()));
|
||||
if (ObjectUtil.isEmpty(importList)) {
|
||||
@@ -487,7 +588,7 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
|
||||
private boolean isCheckData(Long walletId) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<WalletRechargeApplyEntity>().eq(WalletRechargeApplyEntity::getUserId, walletId).eq(WalletRechargeApplyEntity::getProcessStatus, NodeStatusEnum.JXZ.getCode()));
|
||||
return count >= 3;
|
||||
return count >= 10;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+148
-17
@@ -1,31 +1,40 @@
|
||||
package com.bsd.pjcloud.wallet.service.impl.recharge;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.flow.task.constant.TaskCheckStatusEnum;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletBizRechargeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletRechargeInvoiceStatusEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeBindInvoiceDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeApplyEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeImportEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeInvoiceEntity;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteWalletSettingService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletSettingVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeInvoiceEntityItemVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeInvoiceEntityVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeInvoiceItemVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeInvoiceVo;
|
||||
import com.bsd.pjcloud.wallet.mapper.recharge.WalletRechargeApplyMapper;
|
||||
import com.bsd.pjcloud.wallet.mapper.recharge.WalletRechargeImportMapper;
|
||||
import com.bsd.pjcloud.wallet.mapper.recharge.WalletRechargeInvoiceMapper;
|
||||
import com.bsd.pjcloud.wallet.service.WalletRechargeApplyService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletRechargeInvoiceService;
|
||||
import com.bsd.pjcloud.wallet.utils.ConvertCnPriceUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -36,21 +45,47 @@ import java.util.List;
|
||||
public class WalletRechargeInvoiceServiceImpl extends ServiceImpl<WalletRechargeInvoiceMapper, WalletRechargeInvoiceEntity> implements WalletRechargeInvoiceService {
|
||||
|
||||
private final WalletRechargeImportMapper importMapper;
|
||||
|
||||
private final WalletRechargeApplyService applyService;
|
||||
private final WalletRechargeApplyMapper applyMapper;
|
||||
|
||||
private final RemoteUserService remoteUserService;
|
||||
private final RemoteWalletSettingService remoteWalletSettingService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@Override
|
||||
public Page<WalletRechargeInvoiceVo> scopePageList(Page page, WalletRechargeBindInvoiceDto dto, DataScope dataScope) {
|
||||
return baseMapper.scopePageList(page, dto, dataScope);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
*/
|
||||
@Override
|
||||
public WalletRechargeInvoiceVo joinById(Long id) {
|
||||
WalletRechargeInvoiceVo detail = baseMapper.joinById(id);
|
||||
if (ObjectUtil.isEmpty(detail)) return detail;
|
||||
// 转换为元
|
||||
Double price = BigDecimal.valueOf(detail.getTotalPrice()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP).doubleValue();
|
||||
detail.setTotalPriceCnStr(ConvertCnPriceUtil.convert(String.valueOf(price)));
|
||||
// 生成款项
|
||||
WalletRechargeInvoiceItemVo item = new WalletRechargeInvoiceItemVo();
|
||||
item.setName("伙食费充值");
|
||||
item.setPrice(price);
|
||||
detail.setItemJson(JSONUtil.toJsonStr(List.of(item)));
|
||||
return detail;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量充值/扣款发票信息
|
||||
*/
|
||||
@Override
|
||||
public WalletRechargeInvoiceEntityVo getInvoice(Long id) {
|
||||
public WalletRechargeInvoiceVo getInvoice(Long id) {
|
||||
// 查询申请记录
|
||||
WalletRechargeApplyEntity applyDetail = applyService.getById(id);
|
||||
WalletRechargeApplyEntity applyDetail = applyMapper.selectById(id);
|
||||
WalletBizRechargeEnum bizEnum = WalletBizRechargeEnum.valueOfByType(applyDetail.getBizType());
|
||||
if (ObjectUtil.isEmpty(applyDetail)) {
|
||||
throw new RuntimeException(" 批量充值/扣款申请不存在");
|
||||
throw new RuntimeException("批量充值/扣款申请不存在");
|
||||
}
|
||||
// 查询申请记录有没有编辑过
|
||||
if (!ObjectUtil.isAllNotEmpty(applyDetail.getImportTime(), applyDetail.getWalletTypeId())) {
|
||||
@@ -60,6 +95,20 @@ public class WalletRechargeInvoiceServiceImpl extends ServiceImpl<WalletRecharge
|
||||
if (ObjectUtil.notEqual(applyDetail.getProcessStatus(), TaskCheckStatusEnum.PADDING.getCode())) {
|
||||
throw new RuntimeException("只有申请中才能获取发票");
|
||||
}
|
||||
|
||||
// 先去查询有没有已经生产的发票
|
||||
WalletRechargeInvoiceVo result = new WalletRechargeInvoiceVo();
|
||||
WalletRechargeInvoiceEntity InvoiceEntity = baseMapper.selectOne(new LambdaQueryWrapper<WalletRechargeInvoiceEntity>()
|
||||
.eq(WalletRechargeInvoiceEntity::getApplyId, id)
|
||||
.eq(WalletRechargeInvoiceEntity::getStatus, WalletRechargeInvoiceStatusEnum.UNBIND.getCode())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(InvoiceEntity)) {
|
||||
result = BeanUtil.copyProperties(InvoiceEntity, WalletRechargeInvoiceVo.class);
|
||||
Double price = BigDecimal.valueOf(result.getTotalPrice()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP).doubleValue();
|
||||
result.setTotalPriceCnStr(ConvertCnPriceUtil.convert(String.valueOf(price)));
|
||||
return result;
|
||||
}
|
||||
|
||||
// 获取配置
|
||||
WalletSettingVo walletSetting = remoteWalletSettingService.get().getData();
|
||||
// 查询申请人
|
||||
@@ -79,13 +128,12 @@ public class WalletRechargeInvoiceServiceImpl extends ServiceImpl<WalletRecharge
|
||||
List<WalletRechargeImportEntity> importList = importMapper.selectList(new LambdaQueryWrapper<WalletRechargeImportEntity>().eq(WalletRechargeImportEntity::getApplyId, id));
|
||||
Integer totalPrice = importList.stream().map(WalletRechargeImportEntity::getPrice).reduce(Integer::sum).orElse(0);
|
||||
// 转换为元
|
||||
double price = BigDecimal.valueOf(totalPrice).divide(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
Double price = BigDecimal.valueOf(totalPrice).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP).doubleValue();
|
||||
// 生成款项
|
||||
WalletRechargeInvoiceEntityItemVo item = new WalletRechargeInvoiceEntityItemVo();
|
||||
item.setName(LocalDateTimeUtil.format(applyDetail.getImportTime(), DatePattern.NORM_MONTH_PATTERN));
|
||||
WalletRechargeInvoiceItemVo item = new WalletRechargeInvoiceItemVo();
|
||||
item.setName("伙食费充值");
|
||||
item.setPrice(price);
|
||||
|
||||
WalletRechargeInvoiceEntityVo result = new WalletRechargeInvoiceEntityVo();
|
||||
result.setApplyId(applyDetail.getId());
|
||||
result.setCode(getInvoiceCode());
|
||||
result.setTime(applyDetail.getApplyTime());
|
||||
@@ -94,10 +142,78 @@ public class WalletRechargeInvoiceServiceImpl extends ServiceImpl<WalletRecharge
|
||||
result.setTotalPriceCnStr(ConvertCnPriceUtil.convert(String.valueOf(price)));
|
||||
result.setPayeeDept(walletSetting.getTopupDeptStr());
|
||||
result.setPayeeUser(payeeUser);
|
||||
result.setStatus(WalletRechargeInvoiceStatusEnum.DEFAULT.getCode());
|
||||
result.setItemJson(JSONUtil.toJsonStr(item));
|
||||
result.setStatus(WalletRechargeInvoiceStatusEnum.UNBIND.getCode());
|
||||
result.setItemJson(JSONUtil.toJsonStr(List.of(item)));
|
||||
result.setRemark("");
|
||||
return null;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建基础发票
|
||||
*/
|
||||
@Override
|
||||
public WalletRechargeInvoiceEntity createBaseInvoice(PjcloudUser loginUser, Integer totalPrice) {
|
||||
// 查询当前用户
|
||||
UserInfo userInfo = remoteUserService.getByUserId(loginUser.getId()).getData();
|
||||
if (ObjectUtil.isEmpty(userInfo)) throw new RuntimeException("获取当前用户失败");
|
||||
// 获取配置
|
||||
WalletSettingVo walletSetting = remoteWalletSettingService.get().getData();
|
||||
WalletRechargeInvoiceEntity saveObj = new WalletRechargeInvoiceEntity();
|
||||
saveObj.setApplyUserId(userInfo.getSysUser().getUserId());
|
||||
saveObj.setApplyDeptId(userInfo.getSysUser().getDeptId());
|
||||
saveObj.setApplyId(null);
|
||||
saveObj.setCode(getInvoiceCode());
|
||||
saveObj.setTime(LocalDateTime.now());
|
||||
saveObj.setDeptOrUser(userInfo.getSysUser().getName());
|
||||
saveObj.setTotalPrice(totalPrice);
|
||||
if (ObjectUtil.isNotEmpty(walletSetting)) {
|
||||
if (ObjectUtil.isNotEmpty(walletSetting.getTopupUserId())) {
|
||||
// 查询收款人
|
||||
UserInfo payeeUser = remoteUserService.getByUserId(walletSetting.getTopupUserId()).getData();
|
||||
if (ObjectUtil.isNotEmpty(payeeUser)) {
|
||||
saveObj.setPayeeUser(payeeUser.getSysUser().getName());
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(walletSetting.getTopupDeptStr())) {
|
||||
saveObj.setPayeeDept(walletSetting.getTopupDeptStr());
|
||||
}
|
||||
}
|
||||
saveObj.setStatus(WalletRechargeInvoiceStatusEnum.UNBIND.getCode());
|
||||
baseMapper.insert(saveObj);
|
||||
return saveObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑发票
|
||||
*/
|
||||
@Override
|
||||
public Long edit(WalletRechargeInvoiceEntity dto) {
|
||||
// 查询发票是否存在
|
||||
WalletRechargeInvoiceEntity detail = baseMapper.selectById(dto.getId());
|
||||
if (ObjectUtil.isEmpty(detail)) throw new RuntimeException("发票不存在");
|
||||
baseMapper.updateById(dto);
|
||||
return dto.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除发票
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delByIds(ArrayList<Long> list) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
for (Long v : list) {
|
||||
WalletRechargeInvoiceEntity detail = baseMapper.selectById(v);
|
||||
if (ObjectUtil.isEmpty(detail) || ObjectUtil.isEmpty(detail.getApplyId())) continue;
|
||||
if (ObjectUtil.isNotEmpty(detail.getStatus()) && ObjectUtil.notEqual(detail.getStatus(), WalletRechargeInvoiceStatusEnum.UNBIND.getCode())) {
|
||||
UserInfo userInfo = remoteUserService.getByUserId(detail.getApplyUserId()).getData();
|
||||
throw new RuntimeException("用户<" + userInfo.getSysUser().getName() + ">创建的发票已经" + WalletRechargeInvoiceStatusEnum.codeOf(detail.getStatus()).getDesc() + "不能删除");
|
||||
}
|
||||
// 删除申请记录
|
||||
baseMapper.deleteById(v);
|
||||
// 删除申请记录条目
|
||||
importMapper.delete(new LambdaQueryWrapper<WalletRechargeImportEntity>().eq(WalletRechargeImportEntity::getApplyId, v));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,4 +225,19 @@ public class WalletRechargeInvoiceServiceImpl extends ServiceImpl<WalletRecharge
|
||||
count += 1;
|
||||
return String.format("%07d", count);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定发票
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void bindInvoice(WalletRechargeBindInvoiceDto dto) {
|
||||
WalletRechargeInvoiceEntity entity = BeanUtil.toBean(dto, WalletRechargeInvoiceVo.class);
|
||||
entity.setApplyId(null);
|
||||
baseMapper.insertOrUpdate(entity);
|
||||
LambdaUpdateWrapper<WalletRechargeApplyEntity> updateWrapper = new LambdaUpdateWrapper<WalletRechargeApplyEntity>()
|
||||
.set(WalletRechargeApplyEntity::getInvoiceId, entity.getId())
|
||||
.eq(WalletRechargeApplyEntity::getId, entity.getApplyId());
|
||||
applyMapper.update(updateWrapper);
|
||||
}
|
||||
}
|
||||
+11
@@ -24,6 +24,13 @@ public class ConvertCnPriceUtil {
|
||||
// 去掉分隔符
|
||||
amount = amount.replace(",", "");
|
||||
|
||||
String[] split = amount.split("\\.");
|
||||
if (split.length > 1) {
|
||||
if (split[1].length() == 1) {
|
||||
amount = amount + "0";
|
||||
}
|
||||
}
|
||||
|
||||
// 验证金额正确性
|
||||
if (amount.equals("0.00")) {
|
||||
throw new IllegalArgumentException("金额不能为零.");
|
||||
@@ -89,4 +96,8 @@ public class ConvertCnPriceUtil {
|
||||
}
|
||||
return buffer.reverse().toString();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(convert("55.00"));
|
||||
}
|
||||
}
|
||||
+91
-15
@@ -3,19 +3,95 @@
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.wallet.mapper.recharge.WalletRechargeApplyMapper">
|
||||
|
||||
<resultMap id="walletRechargeApplyMap" type="com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeApplyEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="bizType" column="biz_type"/>
|
||||
<result property="walletTypeId" column="wallet_type_id"/>
|
||||
<result property="deptId" column="dept_id"/>
|
||||
<result property="importTime" column="import_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
<sql id="selectA">
|
||||
select a.id,
|
||||
a.user_id,
|
||||
a.invoice_id,
|
||||
a.process_id,
|
||||
a.process_status,
|
||||
a.process_time,
|
||||
a.biz_type,
|
||||
a.wallet_type_id,
|
||||
a.dept_id,
|
||||
a.import_time,
|
||||
a.remark,
|
||||
a.create_by,
|
||||
a.create_time,
|
||||
a.update_by,
|
||||
a.update_time,
|
||||
a.del_flag,
|
||||
a.tenant_id,
|
||||
a.apply_time,
|
||||
a.is_authorization,
|
||||
</sql>
|
||||
|
||||
<sql id="whereA">
|
||||
a.del_flag = '0'
|
||||
<if test="dto.processStatus != null and dto.processStatus != '' ">
|
||||
and a.process_status = #{dto.processStatus}
|
||||
</if>
|
||||
<if test="dto.userId != null">
|
||||
and a.user_id = #{dto.userId}
|
||||
</if>
|
||||
<if test="dto.bizType != null">
|
||||
and a.biz_type = #{dto.bizType}
|
||||
</if>
|
||||
<if test="dto.userIds != null and dto.userIds.size() != 0">
|
||||
and a.user_id in
|
||||
<foreach collection="dto.userIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.walletTypeIds != null and dto.walletTypeIds.size() != 0">
|
||||
and a.wallet_type_id in
|
||||
<foreach collection="dto.walletTypeIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
|
||||
and a.create_time between #{dto.createTimeList[0]} and #{dto.createTimeList[1]}
|
||||
</if>
|
||||
<if test="dto.processTimeList != null and dto.processTimeList.length == 2">
|
||||
and a.create_time between #{dto.processTimeList[0]} and #{dto.processTimeList[1]}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="selectPageA">
|
||||
<include refid="selectA"/>
|
||||
t.name as walletTypeName,
|
||||
t.unique_code as walletTypeUniqueCode,
|
||||
t.icon as walletTypeIcon,
|
||||
t.is_rule as isRule,
|
||||
(select sum(i.price)
|
||||
from wallet_recharge_import i
|
||||
where i.del_flag = '0'
|
||||
and i.apply_id = a.id) as totalPrice
|
||||
from wallet_recharge_apply a
|
||||
left join wallet_type t on a.wallet_type_id = t.id and t.del_flag = '0'
|
||||
<where>
|
||||
<include refid="whereA"/>
|
||||
</where>
|
||||
group by a.id
|
||||
<if test="dto.processStatus != null and dto.processStatus == 2">
|
||||
order by a.process_time desc , a.id desc
|
||||
</if>
|
||||
<if test="dto.processStatus == null or dto.processStatus != 2">
|
||||
ORDER BY
|
||||
CASE
|
||||
WHEN a.apply_time IS NULL THEN 1
|
||||
ELSE 0
|
||||
END ASC,
|
||||
a.apply_time DESC,
|
||||
a.create_time DESC
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="scopePageList" resultType="com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeApplyVo">
|
||||
<include refid="selectPageA" />
|
||||
</select>
|
||||
|
||||
<select id="pageJoin" resultType="com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeApplyVo">
|
||||
<include refid="selectPageA"/>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
+54
-19
@@ -2,29 +2,64 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.wallet.mapper.recharge.WalletRechargeInvoiceMapper">
|
||||
<resultMap id="walletRechargeInvoiceMap"
|
||||
type="com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeInvoiceEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="applyId" column="apply_id"/>
|
||||
<result property="code" column="code"/>
|
||||
<result property="time" column="time"/>
|
||||
<result property="deptOrUser" column="dept_or_user"/>
|
||||
<result property="totalPrice" column="total_price"/>
|
||||
<result property="payeeDept" column="payee_dept"/>
|
||||
<result property="payeeUser" column="payee_user"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
<sql id="selectA">
|
||||
select a.id,
|
||||
a.apply_user_id,
|
||||
a.apply_dept_id,
|
||||
a.apply_id,
|
||||
a.code,
|
||||
a.time,
|
||||
a.dept_or_user,
|
||||
a.total_price,
|
||||
a.payee_dept,
|
||||
a.payee_user,
|
||||
a.item_json,
|
||||
a.remark,
|
||||
a.status,
|
||||
a.pic_url,
|
||||
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.status != null">
|
||||
and a.status = #{dto.status}
|
||||
</if>
|
||||
<if test="dto.userIds != null and dto.userIds.size() != 0">
|
||||
and a.apply_user_id in
|
||||
<foreach collection="dto.userIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
|
||||
and a.create_time between #{dto.createTimeList[0]} and #{dto.createTimeList[1]}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectAllCount" resultType="java.lang.Long">
|
||||
SELECT COUNT(0)
|
||||
FROM wallet_recharge_invoice
|
||||
</select>
|
||||
|
||||
<select id="scopePageList" resultType="com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeInvoiceVo">
|
||||
<include refid="selectA"/>
|
||||
1
|
||||
FROM wallet_recharge_invoice a
|
||||
<where>
|
||||
<include refid="whereA"/>
|
||||
</where>
|
||||
order by a.create_time desc , a.id desc
|
||||
</select>
|
||||
|
||||
<select id="joinById" resultType="com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeInvoiceVo">
|
||||
<include refid="selectA"/>
|
||||
1
|
||||
FROM wallet_recharge_invoice a
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in new issue
Block a user