202506271817
This commit is contained in:
parent
999720d16e
commit
aed6be5c3a
|
|
@ -14,26 +14,15 @@ import com.ruoyi.system.domain.AppleDoMain.AddressApple;
|
|||
import com.ruoyi.system.service.*;
|
||||
import com.winnerlook.model.VoiceResponseResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.stream.Collectors;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import com.ruoyi.system.config.QiniuConfig;
|
||||
import com.ruoyi.system.utils.QiniuUploadUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
|
|
@ -142,8 +131,8 @@ public class AppletController extends BaseController {
|
|||
@Autowired
|
||||
private IUserMemnerConsumptionLogService userMemnerConsumptionLogService;
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private IUsersInvoiceInfoService usersInvoiceInfoService;
|
||||
|
||||
/**
|
||||
* 获取服务分类列表
|
||||
|
|
@ -7593,8 +7582,11 @@ private void setDefaultConfig(Map<String, Object> configData) {
|
|||
|
||||
/**
|
||||
* 会员充值支付接口
|
||||
*
|
||||
* @param params 请求参数,包含id(充值类目ID)、money(充值金额)
|
||||
* @param request HTTP请求对象
|
||||
* @return 支付结果
|
||||
*/
|
||||
|
||||
@PostMapping("api/member/recharge/pay")
|
||||
public AjaxResult memberRechargePay(@RequestBody Map<String, Object> params, HttpServletRequest request) {
|
||||
// 1. 验证用户登录状态
|
||||
|
|
@ -7678,6 +7670,8 @@ private void setDefaultConfig(Map<String, Object> configData) {
|
|||
|
||||
/**
|
||||
* 获取充值类目(用于充值项目选择)
|
||||
*
|
||||
* @return 充值类目列表
|
||||
*/
|
||||
@GetMapping("/api/member/recharge/catalogue")
|
||||
public AjaxResult getRechargeCatalogue() {
|
||||
|
|
@ -7692,20 +7686,15 @@ private void setDefaultConfig(Map<String, Object> configData) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取包年充值项目
|
||||
*
|
||||
* @param id 类型ID
|
||||
* @return 包年充值项目列表
|
||||
*/
|
||||
@GetMapping("/api/member/recharge/catal/{id}")
|
||||
public AjaxResult getRechargeCatalyear(@PathVariable("id") int id) {
|
||||
|
||||
|
||||
try {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
UserMemberRechargeProgram query = new UserMemberRechargeProgram();
|
||||
query.setStatus(0);
|
||||
query.setType(id);
|
||||
|
|
@ -7721,9 +7710,11 @@ private void setDefaultConfig(Map<String, Object> configData) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户充值记录
|
||||
*
|
||||
* @param request HTTP请求对象
|
||||
* @return 用户充值记录列表
|
||||
*/
|
||||
@GetMapping("/api/member/recharge/log")
|
||||
public AjaxResult getRechargelog(HttpServletRequest request) {
|
||||
|
|
@ -7754,9 +7745,11 @@ private void setDefaultConfig(Map<String, Object> configData) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户消费记录
|
||||
*
|
||||
* @param request HTTP请求对象
|
||||
* @return 用户消费记录
|
||||
*/
|
||||
@GetMapping("/api/member/consumption/log")
|
||||
public AjaxResult getconsumptionlog(HttpServletRequest request) {
|
||||
|
|
@ -7786,5 +7779,106 @@ private void setDefaultConfig(Map<String, Object> configData) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用户发票信息保存/修改接口
|
||||
*
|
||||
* @param params 请求参数,包含id(发票信息ID)、invoiceTitle(发票抬头)、taxNumber(纳税人识别号)、bankName(开户银行)、bankAccount(银行账号)、address(单位地址)、phone(联系电话)、email(联系邮箱)、wechat(微信号)、type(发票类型)、category(发票类别)
|
||||
* @param request HTTP请求对象
|
||||
* @return 保存结果
|
||||
*/
|
||||
@PostMapping("/api/user/invoice/info")
|
||||
public AjaxResult saveOrUpdateUserInvoiceInfo(@RequestBody Map<String, Object> params, HttpServletRequest request) {
|
||||
// 1. 验证用户登录状态
|
||||
String token = request.getHeader("token");
|
||||
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
|
||||
if (!(Boolean) userValidation.get("valid")) {
|
||||
return AppletControllerUtil.appletWarning("用户未登录或token无效");
|
||||
}
|
||||
// 2. 获取用户信息
|
||||
Users user = (Users) userValidation.get("user");
|
||||
if (user == null) {
|
||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
||||
}
|
||||
|
||||
// 3. 构建发票信息对象
|
||||
UsersInvoiceInfo info = new UsersInvoiceInfo();
|
||||
info.setUid(user.getId().intValue());
|
||||
info.setInvoiceTitle((String) params.get("invoiceTitle"));
|
||||
info.setTaxNumber((String) params.get("taxNumber"));
|
||||
info.setBankName((String) params.get("bankName"));
|
||||
info.setBankAccount((String) params.get("bankAccount"));
|
||||
info.setAddress((String) params.get("address"));
|
||||
info.setPhone((String) params.get("phone"));
|
||||
info.setEmail((String) params.get("email"));
|
||||
info.setWechat((String) params.get("wechat"));
|
||||
info.setType(Integer.parseInt(params.get("type").toString()));
|
||||
info.setCategory(Integer.parseInt(params.get("category").toString()));
|
||||
|
||||
// 4. 保存或更新发票信息
|
||||
Integer id = params.get("id") != null ? Integer.parseInt(params.get("id").toString()) : null;
|
||||
if (id != null) {
|
||||
info.setId(id);
|
||||
usersInvoiceInfoService.updateUsersInvoiceInfo(info);
|
||||
} else {
|
||||
usersInvoiceInfoService.insertUsersInvoiceInfo(info);
|
||||
}
|
||||
|
||||
return AppletControllerUtil.appletSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户发票信息列表接口
|
||||
*
|
||||
* @param request HTTP请求对象
|
||||
* @return 用户发票信息列表
|
||||
*/
|
||||
@GetMapping("/api/user/invoice/list")
|
||||
public AjaxResult getUserInvoiceInfoList(HttpServletRequest request) {
|
||||
// 1. 验证用户登录状态
|
||||
String token = request.getHeader("token");
|
||||
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
|
||||
if (!(Boolean) userValidation.get("valid")) {
|
||||
return AppletControllerUtil.appletWarning("用户未登录或token无效");
|
||||
}
|
||||
// 2. 获取用户信息
|
||||
Users user = (Users) userValidation.get("user");
|
||||
if (user == null) {
|
||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
||||
}
|
||||
UsersInvoiceInfo query = new UsersInvoiceInfo();
|
||||
query.setUid(user.getId().intValue());
|
||||
// 3. 查询用户发票信息列表
|
||||
List<UsersInvoiceInfo> list = usersInvoiceInfoService.selectUsersInvoiceInfoList(query);
|
||||
return AppletControllerUtil.appletSuccess(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户发票信息接口
|
||||
*
|
||||
* @param id 发票信息ID
|
||||
* @param request HTTP请求对象
|
||||
* @return 删除结果
|
||||
*/
|
||||
@DeleteMapping("/api/user/invoice/info/{id}")
|
||||
public AjaxResult deleteUserInvoiceInfo(@PathVariable("id") Integer id, HttpServletRequest request) {
|
||||
// 1. 验证用户登录状态
|
||||
String token = request.getHeader("token");
|
||||
Map<String, Object> userValidation = AppletLoginUtil.validateUserToken(token, usersService);
|
||||
if (!(Boolean) userValidation.get("valid")) {
|
||||
return AppletControllerUtil.appletWarning("用户未登录或token无效");
|
||||
}
|
||||
// 2. 获取用户信息
|
||||
Users user = (Users) userValidation.get("user");
|
||||
if (user == null) {
|
||||
return AppletControllerUtil.appletWarning("用户信息获取失败");
|
||||
}
|
||||
|
||||
// 3. 删除用户发票信息
|
||||
int result = usersInvoiceInfoService.deleteUsersInvoiceInfoById(id);
|
||||
if (result > 0) {
|
||||
return AppletControllerUtil.appletSuccess();
|
||||
} else {
|
||||
return AppletControllerUtil.appletWarning("删除失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue