Merge remote-tracking branch 'origin/master'

This commit is contained in:
sxu 2025-07-08 16:16:45 +08:00
commit 7b8748024f
5 changed files with 103 additions and 0 deletions

View File

@ -23,6 +23,7 @@ public class AccountInfoQueryParam extends BaseEntity {
private LocalDateTime endDateTime;
private String searchValue;
private Integer userType;
private String userCode;
// @ApiModelProperty("钱包最小金额")
// private BigDecimal walletMinAmount;
// @ApiModelProperty("钱包最大金额")

View File

@ -0,0 +1,64 @@
package com.bonus.canteen.core.zhhq.controller;
import cn.hutool.core.collection.CollUtil;
import com.bonus.canteen.core.account.constants.AccStatusEnum;
import com.bonus.canteen.core.account.domain.param.AccountInfoQueryParam;
import com.bonus.canteen.core.account.domain.vo.AccInfoDetailsVO;
import com.bonus.canteen.core.account.service.IAccInfoService;
import com.bonus.canteen.core.zhhq.domain.AccountInfoDTO;
import com.bonus.canteen.core.zhhq.domain.AccountInfoVO;
import com.bonus.canteen.core.zhhq.domain.WeekRecipeDTO;
import com.bonus.canteen.core.zhhq.service.IZhhqCookRecipeService;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.List;
/**
* 账户信息Controller
*
* @author xsheng
* @date 2025-05-25
*/
@Api(tags = "账户h5接口")
@RestController
@RequestMapping("/api/zhhq/account_info")
@Slf4j
public class ZhhqAccountInfoController extends BaseController {
@Autowired
private IAccInfoService accInfoService;
@ApiOperation("获取员工账户信息")
@PostMapping({"/getBalance"})
public AjaxResult getBalance(@RequestBody @Valid AccountInfoDTO dto) {
try {
AccountInfoQueryParam param = new AccountInfoQueryParam();
param.setUserCode(dto.getEmpCode());
List<AccInfoDetailsVO> list = this.accInfoService.selectAccInfoList(param);
AccountInfoVO accountInfoVO = null;
if(CollUtil.isNotEmpty(list)) {
AccInfoDetailsVO accInfoVO = list.get(0);
accountInfoVO = new AccountInfoVO();
accountInfoVO.setWalletBal(accInfoVO.getWalletBal().divide(BigDecimal.valueOf(100)));
accountInfoVO.setSubsidyBal(accInfoVO.getSubsidyBal().divide(BigDecimal.valueOf(100)));
accountInfoVO.setStatus(AccStatusEnum.NORMAL.getKey().equals(accInfoVO.getAccountStatus()) ? 1 : 2);
}else {
return AjaxResult.error("账户不存在");
}
return AjaxResult.success("卡信息查询成功", accountInfoVO);
} catch (Exception e) {
log.error(e.toString(), e);
return AjaxResult.error(null);
}
}
}

View File

@ -0,0 +1,15 @@
package com.bonus.canteen.core.zhhq.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
@Data
public class AccountInfoDTO {
@ApiModelProperty(value = "食堂id")
@NotNull(message = "员工号不能为空")
private String empCode;
}

View File

@ -0,0 +1,20 @@
package com.bonus.canteen.core.zhhq.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
@Data
public class AccountInfoVO {
@ApiModelProperty(value = "个人钱包余额")
private BigDecimal walletBal;
@ApiModelProperty(value = "补贴钱包余额")
private BigDecimal subsidyBal;
@ApiModelProperty(value = "账户状态")
private Integer status;
}

View File

@ -349,6 +349,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
)
</if>
<if test = "accountInfoQueryParam.userCode != null">
and t2.user_code = #{accountInfoQueryParam.userCode}
</if>
</where>
</sql>