Merge remote-tracking branch 'origin/master'
# Conflicts: # src/main/java/com/muyu/system/service/impl/BuyServiceImpl.javamaster
commit
3a04eb58f9
|
@ -18,7 +18,7 @@ public class SfUtil {
|
||||||
String host = "https://kzidcardv1.market.alicloudapi.com";
|
String host = "https://kzidcardv1.market.alicloudapi.com";
|
||||||
String path = "/api-mall/api/id_card/check";
|
String path = "/api-mall/api/id_card/check";
|
||||||
String method = "POST";
|
String method = "POST";
|
||||||
String appcode = "033359549f644a32858017cd76df3f88";
|
String appcode = "8a8d22ef01b0444e9716c26f7d089149";
|
||||||
Map<String, String> headers = new HashMap<String, String>();
|
Map<String, String> headers = new HashMap<String, String>();
|
||||||
//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
|
//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
|
||||||
headers.put("Authorization", "APPCODE " + appcode);
|
headers.put("Authorization", "APPCODE " + appcode);
|
||||||
|
|
|
@ -15,6 +15,7 @@ import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
import com.muyu.system.domain.resp.ProfileResp;
|
import com.muyu.system.domain.resp.ProfileResp;
|
||||||
import com.muyu.system.service.SysUserService;
|
import com.muyu.system.service.SysUserService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
@ -26,6 +27,7 @@ import java.util.Arrays;
|
||||||
*
|
*
|
||||||
* @author muyu
|
* @author muyu
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/user/profile")
|
@RequestMapping("/user/profile")
|
||||||
public class SysProfileController extends BaseController {
|
public class SysProfileController extends BaseController {
|
||||||
|
@ -105,6 +107,45 @@ public class SysProfileController extends BaseController {
|
||||||
return error("修改密码异常,请联系管理员");
|
return error("修改密码异常,请联系管理员");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置手机号
|
||||||
|
*/
|
||||||
|
@Log(title = "重置手机号", businessType = BusinessType.UPDATE)
|
||||||
|
@RequestMapping(value = "/updatePhonenumber/{phonenumber}",method = RequestMethod.POST)
|
||||||
|
public Result updatePhonenumber(@PathVariable(value = "phonenumber") String phonenumber) {
|
||||||
|
try {
|
||||||
|
if (!isValidPhoneNumber(phonenumber)) {
|
||||||
|
return error("手机号格式不正确");
|
||||||
|
}
|
||||||
|
String username = SecurityUtils.getUsername();
|
||||||
|
SysUser user = userService.selectUserByUserName(username);
|
||||||
|
if (user == null) {
|
||||||
|
return error("用户不存在");
|
||||||
|
}
|
||||||
|
if (userService.updateUserPhonenumber(username, phonenumber) > 0) {
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
loginUser.getSysUser().setPhonenumber(phonenumber);
|
||||||
|
tokenService.setLoginUser(loginUser);
|
||||||
|
return success();
|
||||||
|
} else {
|
||||||
|
return error("修改手机号失败,请联系管理员");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 记录异常日志
|
||||||
|
log.error("更新手机号时发生异常", e);
|
||||||
|
return error("系统异常,请稍后重试");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isValidPhoneNumber(String phoneNumber) {
|
||||||
|
// 正则表达式校验手机号格式
|
||||||
|
String regex = "^1[3-9]\\d{9}$";
|
||||||
|
return phoneNumber.matches(regex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 头像上传
|
* 头像上传
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -11,6 +11,7 @@ import com.muyu.common.security.annotation.InnerAuth;
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.*;
|
import com.muyu.common.system.domain.*;
|
||||||
|
import com.muyu.system.domain.ConnectorLog;
|
||||||
import com.muyu.system.domain.resp.AuthRoleResp;
|
import com.muyu.system.domain.resp.AuthRoleResp;
|
||||||
import com.muyu.system.domain.resp.UserDetailInfoResp;
|
import com.muyu.system.domain.resp.UserDetailInfoResp;
|
||||||
import com.muyu.system.domain.resp.UserInfoResp;
|
import com.muyu.system.domain.resp.UserInfoResp;
|
||||||
|
@ -281,6 +282,27 @@ public class SysUserController extends BaseController {
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
查詢購買記錄
|
||||||
|
@param getBuyRecord
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/purchaseRecord")
|
||||||
|
public Result<TableDataInfo<ConnectorLog>>record(ConnectorLog connectorLog){
|
||||||
|
startPage();
|
||||||
|
List<ConnectorLog> list = userService.selectRecordList(connectorLog);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "记录", businessType = BusinessType.EXPORT)
|
||||||
|
@RequiresPermissions("system:purchaseRecord:export")
|
||||||
|
@PostMapping("/purchaseRecord/export")
|
||||||
|
public void export (HttpServletResponse response, ConnectorLog connectorLog) {
|
||||||
|
List<ConnectorLog> list = userService.selectRecordList(connectorLog);
|
||||||
|
ExcelUtil<ConnectorLog> util = new ExcelUtil<ConnectorLog>(ConnectorLog.class);
|
||||||
|
util.exportExcel(response, list, "记录");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Log(title = "记录", businessType = BusinessType.EXPORT)
|
@Log(title = "记录", businessType = BusinessType.EXPORT)
|
||||||
@RequiresPermissions("system:pay:export")
|
@RequiresPermissions("system:pay:export")
|
||||||
|
@ -294,6 +316,11 @@ public class SysUserController extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户编号获取授权角色
|
* 根据用户编号获取授权角色
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.muyu.system.domain;
|
||||||
|
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: wangxinyuan
|
||||||
|
* @Date: 2024/9/3 下午12:08
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ConnectorLog {
|
||||||
|
|
||||||
|
//id
|
||||||
|
@Excel(name = "序號")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
//数据名称
|
||||||
|
@Excel(name = "數據名稱")
|
||||||
|
private String dataName;
|
||||||
|
|
||||||
|
//金额
|
||||||
|
@Excel(name = "金額")
|
||||||
|
private Double amount;
|
||||||
|
|
||||||
|
//消费时间
|
||||||
|
@Excel(name = "消費時間")
|
||||||
|
// @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private String createTime;
|
||||||
|
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ package com.muyu.system.mapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.system.domain.Connector;
|
import com.muyu.system.domain.Connector;
|
||||||
|
import com.muyu.system.domain.ConnectorLog;
|
||||||
import com.muyu.system.domain.ConnectorUser;
|
import com.muyu.system.domain.ConnectorUser;
|
||||||
import org.apache.catalina.User;
|
import org.apache.catalina.User;
|
||||||
|
|
||||||
|
@ -24,4 +25,6 @@ public interface BuyMapper extends BaseMapper<Connector> {
|
||||||
SysUser selectUser(Long userId);
|
SysUser selectUser(Long userId);
|
||||||
|
|
||||||
void buyPrice(SysUser user);
|
void buyPrice(SysUser user);
|
||||||
|
|
||||||
|
int insertPurchaseRecord(ConnectorLog connectorLog);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.system.mapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.common.system.domain.PaymentParam;
|
import com.muyu.common.system.domain.PaymentParam;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
import com.muyu.system.domain.ConnectorLog;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
@ -160,4 +161,8 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||||
|
|
||||||
SysUser findByPhone(String phonenumber);
|
SysUser findByPhone(String phonenumber);
|
||||||
|
|
||||||
|
|
||||||
|
int updateUserPhonenumber(@Param("username") String username, @Param("phonenumber") String phonenumber);
|
||||||
|
|
||||||
|
List<ConnectorLog> selectRecordList(ConnectorLog connectorLog);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.system.service;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.common.system.domain.PaymentParam;
|
import com.muyu.common.system.domain.PaymentParam;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
import com.muyu.system.domain.ConnectorLog;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -244,4 +245,9 @@ public interface SysUserService extends IService<SysUser> {
|
||||||
String sendCode(String phonenumber);
|
String sendCode(String phonenumber);
|
||||||
|
|
||||||
String checkCode(String phonenumber, String code);
|
String checkCode(String phonenumber, String code);
|
||||||
|
|
||||||
|
|
||||||
|
int updateUserPhonenumber(String username, String phonenumber);
|
||||||
|
|
||||||
|
List<ConnectorLog> selectRecordList(ConnectorLog connectorLog);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@ public class BuyServiceImpl extends ServiceImpl<BuyMapper, Connector> implements
|
||||||
if (i>0){
|
if (i>0){
|
||||||
user.setUserBalance(user.getUserBalance()-connectorUser.getConnectorFrequency()*connectorUser.getConnectorPrice());
|
user.setUserBalance(user.getUserBalance()-connectorUser.getConnectorFrequency()*connectorUser.getConnectorPrice());
|
||||||
buyMapper.buyPrice(user);
|
buyMapper.buyPrice(user);
|
||||||
buyMapper.doBuyInterface(connectorUser);
|
|
||||||
return Result.success(i,"购买成功");
|
return Result.success(i,"购买成功");
|
||||||
}
|
}
|
||||||
ConnectorUser connectorUser1 = buyMapper.selectConnectorUser(connectorUser);
|
ConnectorUser connectorUser1 = buyMapper.selectConnectorUser(connectorUser);
|
||||||
|
|
|
@ -20,6 +20,7 @@ import com.muyu.common.system.domain.SysRole;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.config.AlipayConfig;
|
import com.muyu.config.AlipayConfig;
|
||||||
import com.muyu.config.util.MsgUtil;
|
import com.muyu.config.util.MsgUtil;
|
||||||
|
import com.muyu.system.domain.ConnectorLog;
|
||||||
import com.muyu.system.domain.SysPost;
|
import com.muyu.system.domain.SysPost;
|
||||||
import com.muyu.system.domain.SysUserPost;
|
import com.muyu.system.domain.SysUserPost;
|
||||||
import com.muyu.system.domain.SysUserRole;
|
import com.muyu.system.domain.SysUserRole;
|
||||||
|
@ -586,6 +587,15 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateUserPhonenumber(String username, String phonenumber) {
|
||||||
|
return userMapper.updateUserPhonenumber(username,phonenumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ConnectorLog> selectRecordList(ConnectorLog connectorLog) {
|
||||||
|
return userMapper.selectRecordList(connectorLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,11 @@
|
||||||
|
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertPurchaseRecord">
|
||||||
|
INSERT INTO `three-groups`.`connect_log` ( `data_name`, `amount`, `create_time`)
|
||||||
|
VALUES (#{dataName}, #{amount}, now());
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
<update id="doBuyInterface">
|
<update id="doBuyInterface">
|
||||||
update connector_user set connector_residue_degree=connector_residue_degree+#{connectorFrequency},connector_frequency=connector_frequency+#{connectorFrequency} where connector_id=#{connectorId} and user_id=#{userId}
|
update connector_user set connector_residue_degree=connector_residue_degree+#{connectorFrequency},connector_frequency=connector_frequency+#{connectorFrequency} where connector_id=#{connectorId} and user_id=#{userId}
|
||||||
|
|
|
@ -203,6 +203,10 @@
|
||||||
select phonenumber from sys_user where phonenumber = #{phone}
|
select phonenumber from sys_user where phonenumber = #{phone}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectRecordList" resultType="com.muyu.system.domain.ConnectorLog">
|
||||||
|
select id,data_name,amount ,create_time from connect_log
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<update id="addUserMoney">
|
<update id="addUserMoney">
|
||||||
update sys_user set user_balance = user_balance + #{userBalance} where user_id = #{userId}
|
update sys_user set user_balance = user_balance + #{userBalance} where user_id = #{userId}
|
||||||
|
@ -291,6 +295,12 @@
|
||||||
where user_name = #{userName}
|
where user_name = #{userName}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="updateUserPhonenumber">
|
||||||
|
update sys_user
|
||||||
|
set phonenumber = #{phonenumber}
|
||||||
|
where user_name = #{username}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
<delete id="deleteUserById" parameterType="Long">
|
<delete id="deleteUserById" parameterType="Long">
|
||||||
update sys_user
|
update sys_user
|
||||||
|
|
Loading…
Reference in New Issue