流水记录和分账记录功能

This commit is contained in:
wanggeng 2024-08-08 10:29:21 +08:00
parent 58663cb26c
commit 7ddab1ae68
21 changed files with 729 additions and 181 deletions

9
doc/readme.md Normal file
View File

@ -0,0 +1,9 @@
# 邀请码
说明
1. 一个账号可以有两个邀请码,一个邀请码用于其他账号关联,另一个邀请码是关联其他账号。
2. 邀请码的获取有两种方式:
1. 由管理员直接生成
2. 自己发起申请,管理员审核通过后生成
3. 生成邀请码时,必须设置金额和邀请码返利比例

View File

@ -6,6 +6,7 @@ import cn.com.tenlion.operator.service.user.expand.UserExpandServiceImpl;
import ink.wgink.annotation.CheckRequestBodyAnnotation; import ink.wgink.annotation.CheckRequestBodyAnnotation;
import ink.wgink.interfaces.consts.ISystemConstant; import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.pojo.result.SuccessResult; import ink.wgink.pojo.result.SuccessResult;
import ink.wgink.pojo.result.SuccessResultData;
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.*;
@ -35,4 +36,10 @@ public class UserExpandController {
return userExpandService.get(userId); return userExpandService.get(userId);
} }
@GetMapping("generate-ic")
public SuccessResultData<String> generateIc() {
String ic = userExpandService.generateIc();
return new SuccessResultData<>(ic);
}
} }

View File

@ -54,7 +54,7 @@ public class AccountItemResourceController extends DefaultBaseController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("pay-in-shop") @PostMapping("pay-in-shop")
@CheckRequestBodyAnnotation @CheckRequestBodyAnnotation
public SuccessResult payInShop(@RequestBody AccountItemOrderVO accountItemOrderVO) throws Exception { public synchronized SuccessResult payInShop(@RequestBody AccountItemOrderVO accountItemOrderVO) throws Exception {
String code = EncryptUtil.decode(accountItemOrderVO.getCode()); String code = EncryptUtil.decode(accountItemOrderVO.getCode());
JSONObject jsonObject = JSONObject.parseObject(code); JSONObject jsonObject = JSONObject.parseObject(code);
String time = jsonObject.getString("time"); String time = jsonObject.getString("time");
@ -63,7 +63,7 @@ public class AccountItemResourceController extends DefaultBaseController {
String orderId = jsonObject.getString("orderId"); String orderId = jsonObject.getString("orderId");
Date dateTime = sdf.parse(time); Date dateTime = sdf.parse(time);
long diffInMillis = Math.abs(System.currentTimeMillis() - dateTime.getTime()); long diffInMillis = Math.abs(System.currentTimeMillis() - dateTime.getTime());
int secondsDiff = (int)(diffInMillis / 1000); int secondsDiff = (int) (diffInMillis / 1000);
if (secondsDiff > 30) { if (secondsDiff > 30) {
throw new SaveException("鉴权失败"); throw new SaveException("鉴权失败");
} }
@ -78,7 +78,7 @@ public class AccountItemResourceController extends DefaultBaseController {
accountItemVO.setDescription(accountItemOrderVO.getDescription()); accountItemVO.setDescription(accountItemOrderVO.getDescription());
accountItemVO.setOrderId(accountItemOrderVO.getOrderId()); accountItemVO.setOrderId(accountItemOrderVO.getOrderId());
accountItemVO.setOrderType("shop"); accountItemVO.setOrderType("shop");
accountItemService.saveShopReturnId( accountItemVO); accountItemService.saveShopReturnId(accountItemVO);
return new SuccessResult(); return new SuccessResult();
} }
@ -89,7 +89,7 @@ public class AccountItemResourceController extends DefaultBaseController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("pay-in-agent") @PostMapping("pay-in-agent")
@CheckRequestBodyAnnotation @CheckRequestBodyAnnotation
public SuccessResult payInAgent(@RequestBody AccountItemOrderVO accountItemOrderVO) throws Exception { public synchronized SuccessResult payInAgent(@RequestBody AccountItemOrderVO accountItemOrderVO) throws Exception {
String code = EncryptUtil.decode(accountItemOrderVO.getCode()); String code = EncryptUtil.decode(accountItemOrderVO.getCode());
JSONObject jsonObject = JSONObject.parseObject(code); JSONObject jsonObject = JSONObject.parseObject(code);
String time = jsonObject.getString("time"); String time = jsonObject.getString("time");
@ -98,7 +98,7 @@ public class AccountItemResourceController extends DefaultBaseController {
String orderId = jsonObject.getString("orderId"); String orderId = jsonObject.getString("orderId");
Date dateTime = sdf.parse(time); Date dateTime = sdf.parse(time);
long diffInMillis = Math.abs(System.currentTimeMillis() - dateTime.getTime()); long diffInMillis = Math.abs(System.currentTimeMillis() - dateTime.getTime());
int secondsDiff = (int)(diffInMillis / 1000); int secondsDiff = (int) (diffInMillis / 1000);
if (secondsDiff > 30) { if (secondsDiff > 30) {
throw new SaveException("鉴权失败"); throw new SaveException("鉴权失败");
} }
@ -124,7 +124,7 @@ public class AccountItemResourceController extends DefaultBaseController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("pay-in/{type}") @PostMapping("pay-in/{type}")
@CheckRequestBodyAnnotation @CheckRequestBodyAnnotation
public SuccessResult payIn(@PathVariable("type") String type, @RequestBody AccountItemOrderVO accountItemOrderVO) throws Exception { public synchronized SuccessResult payIn(@PathVariable("type") String type, @RequestBody AccountItemOrderVO accountItemOrderVO) throws Exception {
String code = EncryptUtil.decode(accountItemOrderVO.getCode()); String code = EncryptUtil.decode(accountItemOrderVO.getCode());
JSONObject jsonObject = JSONObject.parseObject(code); JSONObject jsonObject = JSONObject.parseObject(code);
String time = jsonObject.getString("time"); String time = jsonObject.getString("time");
@ -133,7 +133,7 @@ public class AccountItemResourceController extends DefaultBaseController {
String orderId = jsonObject.getString("orderId"); String orderId = jsonObject.getString("orderId");
Date dateTime = sdf.parse(time); Date dateTime = sdf.parse(time);
long diffInMillis = Math.abs(System.currentTimeMillis() - dateTime.getTime()); long diffInMillis = Math.abs(System.currentTimeMillis() - dateTime.getTime());
int secondsDiff = (int)(diffInMillis / 1000); int secondsDiff = (int) (diffInMillis / 1000);
if (secondsDiff > 30) { if (secondsDiff > 30) {
throw new SaveException("鉴权失败"); throw new SaveException("鉴权失败");
} }
@ -161,7 +161,7 @@ public class AccountItemResourceController extends DefaultBaseController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("pay-out/{type}") @PostMapping("pay-out/{type}")
@CheckRequestBodyAnnotation @CheckRequestBodyAnnotation
public SuccessResult payOut(@PathVariable("type") String type, @RequestBody AccountItemOrderVO accountItemOrderVO) throws Exception { public synchronized SuccessResult payOut(@PathVariable("type") String type, @RequestBody AccountItemOrderVO accountItemOrderVO) throws Exception {
String code = EncryptUtil.decode(accountItemOrderVO.getCode()); String code = EncryptUtil.decode(accountItemOrderVO.getCode());
JSONObject jsonObject = JSONObject.parseObject(code); JSONObject jsonObject = JSONObject.parseObject(code);
String time = jsonObject.getString("time"); String time = jsonObject.getString("time");
@ -170,7 +170,7 @@ public class AccountItemResourceController extends DefaultBaseController {
String orderId = jsonObject.getString("orderId"); String orderId = jsonObject.getString("orderId");
Date dateTime = sdf.parse(time); Date dateTime = sdf.parse(time);
long diffInMillis = Math.abs(System.currentTimeMillis() - dateTime.getTime()); long diffInMillis = Math.abs(System.currentTimeMillis() - dateTime.getTime());
int secondsDiff = (int)(diffInMillis / 1000); int secondsDiff = (int) (diffInMillis / 1000);
if (secondsDiff > 30) { if (secondsDiff > 30) {
throw new SaveException("鉴权失败"); throw new SaveException("鉴权失败");
} }
@ -210,15 +210,12 @@ public class AccountItemResourceController extends DefaultBaseController {
@ApiImplicitParam(name = "rows", value = "每页数量", paramType = "query") @ApiImplicitParam(name = "rows", value = "每页数量", paramType = "query")
}) })
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpage/{userId}/{page}/{rows}") @GetMapping("listpage/{userId}")
public SuccessResultList<List<AccountItemBO>> listPage(@PathVariable("userId") String userId, @PathVariable("page") Integer page, @PathVariable("rows") Integer rows) { public SuccessResultList<List<AccountItemDTO>> listPage(@PathVariable("userId") String userId, ListPage page) {
ListPage pages = new ListPage();
pages.setPage(page);
pages.setRows(rows);
Map<String, Object> params = requestParams(); Map<String, Object> params = requestParams();
params.put("accountId", userId); params.put("accountId", userId);
pages.setParams(params); page.setParams(params);
return accountItemService.listPageBO(pages); return accountItemService.listPage(page);
} }
} }

View File

@ -0,0 +1,42 @@
package cn.com.tenlion.operator.controller.resource.user.expand;
import cn.com.tenlion.operator.pojo.vos.user.expand.ic.UserExpandRelationIcVO;
import cn.com.tenlion.operator.service.user.expand.UserExpandServiceImpl;
import ink.wgink.annotation.CheckRequestBodyAnnotation;
import ink.wgink.common.base.DefaultBaseController;
import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.pojo.result.ErrorResult;
import ink.wgink.pojo.result.SuccessResult;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* ClassName: UserExpandResourceController
* Description:
* Author: wanggeng
* Date: 2024/8/6 下午3:28
* Version: 1.0
*/
@Api(tags = ISystemConstant.API_TAGS_RESOURCE_PREFIX + "用户拓展接口")
@RestController
@RequestMapping(ISystemConstant.RESOURCE_PREFIX + "/user/expand")
public class UserExpandResourceController extends DefaultBaseController {
@Autowired
private UserExpandServiceImpl userExpandService;
@ApiOperation(value = "更新关联邀请码", notes = "更新关联邀请码接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("update-relation-ic/user-id/{userId}")
@CheckRequestBodyAnnotation
public synchronized SuccessResult updateRelationIcByUserId(@PathVariable("userId") String userId,
@RequestBody UserExpandRelationIcVO userExpandIcVO) {
userExpandService.updateRelationIcByUserId(userId, userExpandIcVO);
return new SuccessResult();
}
}

View File

@ -35,9 +35,8 @@ public class AccountItemRouteController extends DefaultBaseController {
} }
@GetMapping("list") @GetMapping("list")
public ModelAndView list(String accountId) { public ModelAndView list() {
ModelAndView mv = new ModelAndView("accountitem/list"); ModelAndView mv = new ModelAndView("accountitem/list");
mv.addObject("accountId", accountId);
return mv; return mv;
} }

View File

@ -18,7 +18,7 @@ import org.springframework.web.servlet.ModelAndView;
public class UserExpandRouteController { public class UserExpandRouteController {
@GetMapping("save-or-update") @GetMapping("save-or-update")
public ModelAndView update() { public ModelAndView saveOrUpdate() {
ModelAndView modelAndView = new ModelAndView("user/expand/save-or-update"); ModelAndView modelAndView = new ModelAndView("user/expand/save-or-update");
return modelAndView; return modelAndView;
} }

View File

@ -4,6 +4,7 @@ import cn.com.tenlion.operator.pojo.dtos.user.expand.UserExpandDTO;
import cn.com.tenlion.operator.pojo.pos.user.expand.UserExpandPO; import cn.com.tenlion.operator.pojo.pos.user.expand.UserExpandPO;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -20,8 +21,16 @@ public interface IUserExpandDao {
void update(Map<String, Object> params); void update(Map<String, Object> params);
void updateRelationIc(Map<String, Object> params);
void updateRelationRebateRatio(Map<String, Object> params);
UserExpandDTO get(Map<String, Object> params); UserExpandDTO get(Map<String, Object> params);
UserExpandPO getPO(Map<String, Object> params); UserExpandPO getPO(Map<String, Object> params);
Integer countIc(String string);
List<String> listUserIdByRelationUserId(String userId);
} }

View File

@ -0,0 +1,24 @@
package cn.com.tenlion.operator.enums;
/**
* ClassName: IcWayToGetEnum
* Description:
* Author: wanggeng
* Date: 2024/8/2 下午5:10
* Version: 1.0
*/
public enum IcWayToGetEnum {
ASSIGN("分配"),
APPLY("申请");
private final String text;
IcWayToGetEnum(String text) {
this.text = text;
}
public String getText() {
return text == null ? "" : text.trim();
}
}

View File

@ -4,7 +4,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
/** /**
*
* @ClassName: AccountItemDTO * @ClassName: AccountItemDTO
* @Description: 客户账户流水 * @Description: 客户账户流水
* @Author: CodeFactory * @Author: CodeFactory
@ -20,6 +19,8 @@ public class AccountItemDTO {
private String accountId; private String accountId;
@ApiModelProperty(name = "accountBeforeMoney", value = "动账前余额") @ApiModelProperty(name = "accountBeforeMoney", value = "动账前余额")
private Integer accountBeforeMoney; private Integer accountBeforeMoney;
@ApiModelProperty(name = "accountBeforeMoneyDouble", value = "动账前余额")
private Double accountBeforeMoneyDouble;
@ApiModelProperty(name = "accountAfterMoney", value = "动账后余额") @ApiModelProperty(name = "accountAfterMoney", value = "动账后余额")
private Integer accountAfterMoney; private Integer accountAfterMoney;
@ApiModelProperty(name = "accountAfterMoney", value = "动账后余额") @ApiModelProperty(name = "accountAfterMoney", value = "动账后余额")
@ -45,30 +46,6 @@ public class AccountItemDTO {
@ApiModelProperty(name = "gmtCreate", value = "交易时间") @ApiModelProperty(name = "gmtCreate", value = "交易时间")
private String gmtCreate; private String gmtCreate;
public String getOrderType() {
return orderType == null ? "" : orderType.trim();
}
public void setOrderType(String orderType) {
this.orderType = orderType;
}
public Double getAccountAfterMoneyDouble() {
return accountAfterMoneyDouble == null ? 0 : accountAfterMoneyDouble;
}
public void setAccountAfterMoneyDouble(Double accountAfterMoneyDouble) {
this.accountAfterMoneyDouble = accountAfterMoneyDouble;
}
public Double getAccountMoneyDouble() {
return accountMoneyDouble == null ? 0 : accountMoneyDouble;
}
public void setAccountMoneyDouble(Double accountMoneyDouble) {
this.accountMoneyDouble = accountMoneyDouble;
}
public String getAccountItemId() { public String getAccountItemId() {
return accountItemId == null ? "" : accountItemId.trim(); return accountItemId == null ? "" : accountItemId.trim();
} }
@ -93,6 +70,14 @@ public class AccountItemDTO {
this.accountBeforeMoney = accountBeforeMoney; this.accountBeforeMoney = accountBeforeMoney;
} }
public Double getAccountBeforeMoneyDouble() {
return accountBeforeMoneyDouble == null ? 0 : accountBeforeMoneyDouble;
}
public void setAccountBeforeMoneyDouble(Double accountBeforeMoneyDouble) {
this.accountBeforeMoneyDouble = accountBeforeMoneyDouble;
}
public Integer getAccountAfterMoney() { public Integer getAccountAfterMoney() {
return accountAfterMoney == null ? 0 : accountAfterMoney; return accountAfterMoney == null ? 0 : accountAfterMoney;
} }
@ -101,6 +86,14 @@ public class AccountItemDTO {
this.accountAfterMoney = accountAfterMoney; this.accountAfterMoney = accountAfterMoney;
} }
public Double getAccountAfterMoneyDouble() {
return accountAfterMoneyDouble == null ? 0 : accountAfterMoneyDouble;
}
public void setAccountAfterMoneyDouble(Double accountAfterMoneyDouble) {
this.accountAfterMoneyDouble = accountAfterMoneyDouble;
}
public Integer getAccountMoney() { public Integer getAccountMoney() {
return accountMoney == null ? 0 : accountMoney; return accountMoney == null ? 0 : accountMoney;
} }
@ -109,6 +102,14 @@ public class AccountItemDTO {
this.accountMoney = accountMoney; this.accountMoney = accountMoney;
} }
public Double getAccountMoneyDouble() {
return accountMoneyDouble == null ? 0 : accountMoneyDouble;
}
public void setAccountMoneyDouble(Double accountMoneyDouble) {
this.accountMoneyDouble = accountMoneyDouble;
}
public Integer getMode() { public Integer getMode() {
return mode == null ? 0 : mode; return mode == null ? 0 : mode;
} }
@ -141,6 +142,14 @@ public class AccountItemDTO {
this.orderId = orderId; this.orderId = orderId;
} }
public String getOrderType() {
return orderType == null ? "" : orderType.trim();
}
public void setOrderType(String orderType) {
this.orderType = orderType;
}
public String getCheckStatus() { public String getCheckStatus() {
return checkStatus == null ? "" : checkStatus.trim(); return checkStatus == null ? "" : checkStatus.trim();
} }
@ -164,6 +173,4 @@ public class AccountItemDTO {
public void setGmtCreate(String gmtCreate) { public void setGmtCreate(String gmtCreate) {
this.gmtCreate = gmtCreate; this.gmtCreate = gmtCreate;
} }
} }

View File

@ -25,6 +25,15 @@ public class UserExpandDTO extends UserDTO {
private Integer postpaidCount; private Integer postpaidCount;
private Integer freeProjCount; private Integer freeProjCount;
private Integer correctionCount; private Integer correctionCount;
private String ic;
private Integer icRebateRatio;
private String icWayToGet;
private String icGetTime;
private String icAssignUserId;
private String relationIc;
private Integer relationIcRebateRatio;
private String relationIcTime;
private String relationIcUserId;
public Long getPriceAdditionalPkg() { public Long getPriceAdditionalPkg() {
return priceAdditionalPkg == null ? 0 : priceAdditionalPkg; return priceAdditionalPkg == null ? 0 : priceAdditionalPkg;
@ -121,4 +130,76 @@ public class UserExpandDTO extends UserDTO {
public void setCorrectionCount(Integer correctionCount) { public void setCorrectionCount(Integer correctionCount) {
this.correctionCount = correctionCount; this.correctionCount = correctionCount;
} }
public String getIc() {
return ic == null ? "" : ic.trim();
}
public void setIc(String ic) {
this.ic = ic;
}
public Integer getIcRebateRatio() {
return icRebateRatio == null ? 0 : icRebateRatio;
}
public void setIcRebateRatio(Integer icRebateRatio) {
this.icRebateRatio = icRebateRatio;
}
public String getIcWayToGet() {
return icWayToGet == null ? "" : icWayToGet.trim();
}
public void setIcWayToGet(String icWayToGet) {
this.icWayToGet = icWayToGet;
}
public String getIcGetTime() {
return icGetTime == null ? "" : icGetTime.trim();
}
public void setIcGetTime(String icGetTime) {
this.icGetTime = icGetTime;
}
public String getIcAssignUserId() {
return icAssignUserId == null ? "" : icAssignUserId.trim();
}
public void setIcAssignUserId(String icAssignUserId) {
this.icAssignUserId = icAssignUserId;
}
public String getRelationIc() {
return relationIc == null ? "" : relationIc.trim();
}
public void setRelationIc(String relationIc) {
this.relationIc = relationIc;
}
public Integer getRelationIcRebateRatio() {
return relationIcRebateRatio == null ? 0 : relationIcRebateRatio;
}
public void setRelationIcRebateRatio(Integer relationIcRebateRatio) {
this.relationIcRebateRatio = relationIcRebateRatio;
}
public String getRelationIcTime() {
return relationIcTime == null ? "" : relationIcTime.trim();
}
public void setRelationIcTime(String relationIcTime) {
this.relationIcTime = relationIcTime;
}
public String getRelationIcUserId() {
return relationIcUserId == null ? "" : relationIcUserId.trim();
}
public void setRelationIcUserId(String relationIcUserId) {
this.relationIcUserId = relationIcUserId;
}
} }

View File

@ -29,7 +29,7 @@ public class UserInfoDTO {
private String contactPhone; private String contactPhone;
@ApiModelProperty(name = "contactName", value = "联系人姓名") @ApiModelProperty(name = "contactName", value = "联系人姓名")
private String contactName; private String contactName;
@ApiModelProperty(name = "contactName", value = "英文名称") @ApiModelProperty(name = "userInfoNameEn", value = "英文名称")
private String userInfoNameEn; private String userInfoNameEn;
@ApiModelProperty(name = "userUsername", value = "用户名") @ApiModelProperty(name = "userUsername", value = "用户名")
private String userUsername; private String userUsername;

View File

@ -1,5 +1,7 @@
package cn.com.tenlion.operator.pojo.pos.user.expand; package cn.com.tenlion.operator.pojo.pos.user.expand;
import cn.com.tenlion.operator.enums.IcWayToGetEnum;
/** /**
* @ClassName: UserExpandDTO * @ClassName: UserExpandDTO
* @Description: * @Description:
@ -22,6 +24,15 @@ public class UserExpandPO {
private Integer postpaidCount; private Integer postpaidCount;
private Integer freeProjCount; private Integer freeProjCount;
private Integer correctionCount; private Integer correctionCount;
private String ic;
private Integer icRebateRatio;
private IcWayToGetEnum icWayToGet;
private String icGetTime;
private String icAssignUserId;
private String relationIc;
private Integer relationIcRebateRatio;
private String relationIcTime;
private String relationIcUserId;
public String getUserId() { public String getUserId() {
return userId == null ? "" : userId.trim(); return userId == null ? "" : userId.trim();
@ -126,4 +137,76 @@ public class UserExpandPO {
public void setCorrectionCount(Integer correctionCount) { public void setCorrectionCount(Integer correctionCount) {
this.correctionCount = correctionCount; this.correctionCount = correctionCount;
} }
public String getIc() {
return ic == null ? "" : ic.trim();
}
public void setIc(String ic) {
this.ic = ic;
}
public Integer getIcRebateRatio() {
return icRebateRatio == null ? 0 : icRebateRatio;
}
public void setIcRebateRatio(Integer icRebateRatio) {
this.icRebateRatio = icRebateRatio;
}
public IcWayToGetEnum getIcWayToGet() {
return icWayToGet;
}
public void setIcWayToGet(IcWayToGetEnum icWayToGet) {
this.icWayToGet = icWayToGet;
}
public String getIcGetTime() {
return icGetTime == null ? "" : icGetTime.trim();
}
public void setIcGetTime(String icGetTime) {
this.icGetTime = icGetTime;
}
public String getIcAssignUserId() {
return icAssignUserId == null ? "" : icAssignUserId.trim();
}
public void setIcAssignUserId(String icAssignUserId) {
this.icAssignUserId = icAssignUserId;
}
public String getRelationIc() {
return relationIc == null ? "" : relationIc.trim();
}
public void setRelationIc(String relationIc) {
this.relationIc = relationIc;
}
public Integer getRelationIcRebateRatio() {
return relationIcRebateRatio == null ? 0 : relationIcRebateRatio;
}
public void setRelationIcRebateRatio(Integer relationIcRebateRatio) {
this.relationIcRebateRatio = relationIcRebateRatio;
}
public String getRelationIcTime() {
return relationIcTime == null ? "" : relationIcTime.trim();
}
public void setRelationIcTime(String relationIcTime) {
this.relationIcTime = relationIcTime;
}
public String getRelationIcUserId() {
return relationIcUserId == null ? "" : relationIcUserId.trim();
}
public void setRelationIcUserId(String relationIcUserId) {
this.relationIcUserId = relationIcUserId;
}
} }

View File

@ -34,6 +34,8 @@ public class UserExpandVO {
private Integer freeProjCount; private Integer freeProjCount;
@CheckNumberAnnotation(name = "资料补正次数", min = 0, max = 10) @CheckNumberAnnotation(name = "资料补正次数", min = 0, max = 10)
private Integer correctionCount; private Integer correctionCount;
private String ic;
private Integer icRebateRatio;
public Double getPriceAdditionalPkg() { public Double getPriceAdditionalPkg() {
return priceAdditionalPkg == null ? 0 : priceAdditionalPkg; return priceAdditionalPkg == null ? 0 : priceAdditionalPkg;
@ -130,4 +132,20 @@ public class UserExpandVO {
public void setCorrectionCount(Integer correctionCount) { public void setCorrectionCount(Integer correctionCount) {
this.correctionCount = correctionCount; this.correctionCount = correctionCount;
} }
public String getIc() {
return ic == null ? "" : ic.trim();
}
public void setIc(String ic) {
this.ic = ic;
}
public Integer getIcRebateRatio() {
return icRebateRatio == null ? 0 : icRebateRatio;
}
public void setIcRebateRatio(Integer icRebateRatio) {
this.icRebateRatio = icRebateRatio;
}
} }

View File

@ -0,0 +1,25 @@
package cn.com.tenlion.operator.pojo.vos.user.expand.ic;
import ink.wgink.annotation.CheckEmptyAnnotation;
/**
* ClassName: UserExpandIcVO
* Description:
* Author: wanggeng
* Date: 2024/8/6 下午3:23
* Version: 1.0
*/
public class UserExpandRelationIcVO {
@CheckEmptyAnnotation(name = "关联邀请码")
private String relationIc;
public String getRelationIc() {
return relationIc == null ? "" : relationIc.trim();
}
public void setRelationIc(String relationIc) {
this.relationIc = relationIc;
}
}

View File

@ -223,6 +223,7 @@ public class AccountItemServiceImpl extends DefaultBaseService implements IAccou
for (AccountItemDTO dto : list) { for (AccountItemDTO dto : list) {
dto.setAccountMoneyDouble(PayUtil.buiderMoney(dto.getAccountMoney())); dto.setAccountMoneyDouble(PayUtil.buiderMoney(dto.getAccountMoney()));
dto.setAccountAfterMoneyDouble(PayUtil.buiderMoney(dto.getAccountAfterMoney())); dto.setAccountAfterMoneyDouble(PayUtil.buiderMoney(dto.getAccountAfterMoney()));
dto.setAccountBeforeMoneyDouble(PayUtil.buiderMoney(dto.getAccountBeforeMoney()));
} }
return list; return list;
} }

View File

@ -1,9 +1,11 @@
package cn.com.tenlion.operator.service.user.expand; package cn.com.tenlion.operator.service.user.expand;
import cn.com.tenlion.operator.dao.user.expand.IUserExpandDao; import cn.com.tenlion.operator.dao.user.expand.IUserExpandDao;
import cn.com.tenlion.operator.enums.IcWayToGetEnum;
import cn.com.tenlion.operator.pojo.dtos.user.expand.UserExpandDTO; import cn.com.tenlion.operator.pojo.dtos.user.expand.UserExpandDTO;
import cn.com.tenlion.operator.pojo.pos.user.expand.UserExpandPO; import cn.com.tenlion.operator.pojo.pos.user.expand.UserExpandPO;
import cn.com.tenlion.operator.pojo.vos.user.expand.UserExpandVO; import cn.com.tenlion.operator.pojo.vos.user.expand.UserExpandVO;
import cn.com.tenlion.operator.pojo.vos.user.expand.ic.UserExpandRelationIcVO;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import ink.wgink.common.base.DefaultBaseService; import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.exceptions.SearchException; import ink.wgink.exceptions.SearchException;
@ -12,7 +14,9 @@ import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.dtos.user.UserDTO; import ink.wgink.pojo.dtos.user.UserDTO;
import ink.wgink.pojo.result.SuccessResultList; import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.service.user.service.IUserService; import ink.wgink.service.user.service.IUserService;
import ink.wgink.util.date.DateUtil;
import ink.wgink.util.map.HashMapUtil; import ink.wgink.util.map.HashMapUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
@ -21,6 +25,8 @@ import org.springframework.stereotype.Service;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random;
import java.util.stream.Collectors;
/** /**
* @ClassName: UserExpandServiceImpl * @ClassName: UserExpandServiceImpl
@ -135,9 +141,6 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
} }
public void saveOrUpdate(String userId, UserExpandVO userExpandVO) { public void saveOrUpdate(String userId, UserExpandVO userExpandVO) {
Map<String, Object> params = getHashMap(2);
params.put("userId", userId);
UserExpandDTO userExpandDTO = userExpandDao.get(params);
userExpandVO.setPriceAdditionalPkg(userExpandVO.getPriceAdditionalPkg() * 100); userExpandVO.setPriceAdditionalPkg(userExpandVO.getPriceAdditionalPkg() * 100);
userExpandVO.setPriceAdditionalVideoDemo(userExpandVO.getPriceAdditionalVideoDemo() * 100); userExpandVO.setPriceAdditionalVideoDemo(userExpandVO.getPriceAdditionalVideoDemo() * 100);
userExpandVO.setPriceAdditionalUrgent(userExpandVO.getPriceAdditionalUrgent() * 100); userExpandVO.setPriceAdditionalUrgent(userExpandVO.getPriceAdditionalUrgent() * 100);
@ -145,13 +148,135 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
userExpandVO.setPriceMaterial(userExpandVO.getPriceMaterial() * 100); userExpandVO.setPriceMaterial(userExpandVO.getPriceMaterial() * 100);
userExpandVO.setPriceMaterialAgent(userExpandVO.getPriceMaterialAgent() * 100); userExpandVO.setPriceMaterialAgent(userExpandVO.getPriceMaterialAgent() * 100);
userExpandVO.setPriceMaterialAgentUrgent(userExpandVO.getPriceMaterialAgentUrgent() * 100); userExpandVO.setPriceMaterialAgentUrgent(userExpandVO.getPriceMaterialAgentUrgent() * 100);
Map<String, Object> params = getHashMap(2);
params.put("userId", userId);
params = HashMapUtil.beanToMap(userExpandVO); params = HashMapUtil.beanToMap(userExpandVO);
params.put("userId", userId); params.put("userId", userId);
if (StringUtils.isNotBlank(userExpandVO.getIc())) {
params.put("icWayToGet", IcWayToGetEnum.ASSIGN);
params.put("icGetTime", DateUtil.getTime());
}
UserExpandDTO userExpandDTO = userExpandDao.get(params);
if (userExpandDTO == null) { if (userExpandDTO == null) {
if (StringUtils.isNotBlank(userExpandVO.getIc()) && countIc(userExpandVO.getIc()) > 0) {
throw new SearchException("邀请码已存在,请重新生成");
}
userExpandDao.save(params); userExpandDao.save(params);
} else { } else {
if (StringUtils.isNotBlank(userExpandDTO.getRelationIc()) &&
StringUtils.equals("ACTIVE", userExpandVO.getPostpaid())) {
throw new SearchException("已经绑定邀请码的用户不能设置为后付费用户");
}
if (StringUtils.isNotBlank(userExpandDTO.getIc())) {
params.remove("ic");
params.remove("icGetTime");
params.remove("icAssignUserId");
} else {
if (StringUtils.isNotBlank(userExpandVO.getIc()) && countIc(userExpandVO.getIc()) > 0) {
throw new SearchException("邀请码已存在,请重新生成");
}
}
userExpandDao.update(params); userExpandDao.update(params);
} }
updateRedis(userId); updateRedis(userId);
updateBatchRelationRebateRatio(userId, userExpandDTO == null ? 0 : userExpandDTO.getIcRebateRatio(), userExpandVO.getIcRebateRatio());
}
/**
* 批量更新返利比率
*
* @param userId
*/
private void updateBatchRelationRebateRatio(String userId, Integer oldRebateRatio, Integer newRebateRatio) {
if (oldRebateRatio != null && oldRebateRatio.equals(newRebateRatio)) {
return;
}
Map<String, Object> params = getHashMap(4);
params.put("relationIcUserId", userId);
params.put("relationIcRebateRatio", newRebateRatio);
userExpandDao.updateRelationRebateRatio(params);
LOG.debug("批量更新redis");
List<String> relationUserIds = userExpandDao.listUserIdByRelationUserId(userId).stream().map(id -> "user:expand:" + id).collect(Collectors.toList());
if (relationUserIds.isEmpty()) {
LOG.debug("没有关联邀请码的用户");
return;
}
List<String> redisJsons = redisTemplate.opsForValue().multiGet(relationUserIds);
if (redisJsons == null) {
LOG.debug("redis中不存在需要更新返利比率的的用户");
return;
}
redisJsons.forEach(json -> {
UserExpandPO userExpandPO = JSON.parseObject(json, UserExpandPO.class);
userExpandPO.setRelationIcRebateRatio(newRebateRatio);
updateRedis(userExpandPO);
});
}
public String generateIc() {
StringBuilder icSB = new StringBuilder();
Random random = new Random(System.currentTimeMillis());
while (icSB.length() < 6) {
int type = random.nextInt(3);
if (type == 0) {
int num = random.nextInt(10);
icSB.append(num);
} else if (type == 1) {
int letter = 65 + random.nextInt(26);
icSB.append((char) letter);
} else {
int letter = 97 + random.nextInt(26);
icSB.append((char) letter);
}
}
return icSB.toString();
}
/**
* 邀请码数量
*
* @param ic
* @return
*/
private Integer countIc(String ic) {
Integer count = userExpandDao.countIc(ic);
return count == null ? 0 : count;
}
public void updateRelationIcByUserId(String userId, UserExpandRelationIcVO userExpandIcVO) {
UserExpandPO selfPO = getPO(userId);
if (selfPO == null) {
throw new SearchException("用户不存在");
}
if (StringUtils.equals("ACTIVE", selfPO.getPostpaid())) {
throw new SearchException("后付费用户不能绑定邀请码");
}
if (StringUtils.isNotBlank(selfPO.getRelationIc())) {
throw new SearchException("已经绑定过邀请码");
}
UserExpandPO icUserPO = getPOByIc(userExpandIcVO.getRelationIc());
if (icUserPO == null) {
throw new SearchException("邀请码不正确");
}
if (StringUtils.equals(icUserPO.getUserId(), userId)) {
throw new SearchException("不能绑定自己的邀请码");
}
Map<String, Object> params = getHashMap(4);
params.put("priceAll", icUserPO.getPriceAll());
params.put("priceMaterial", icUserPO.getPriceMaterial());
params.put("relationIc", userExpandIcVO.getRelationIc());
params.put("relationIcRebateRatio", icUserPO.getIcRebateRatio());
params.put("relationIcTime", DateUtil.getTime());
params.put("relationIcUserId", icUserPO.getUserId());
params.put("userId", userId);
userExpandDao.updateRelationIc(params);
updateRedis(userId);
}
private UserExpandPO getPOByIc(String ic) {
Map<String, Object> params = getHashMap(2);
params.put("ic", ic);
return userExpandDao.getPO(params);
} }
} }

View File

@ -16,6 +16,15 @@
<result column="postpaid_count" property="postpaidCount"/> <result column="postpaid_count" property="postpaidCount"/>
<result column="free_proj_count" property="freeProjCount"/> <result column="free_proj_count" property="freeProjCount"/>
<result column="correction_count" property="correctionCount"/> <result column="correction_count" property="correctionCount"/>
<result column="ic" property="ic"/>
<result column="ic_rebate_ratio" property="icRebateRatio"/>
<result column="ic_way_to_get" property="icWayToGet"/>
<result column="ic_get_time" property="icGetTime"/>
<result column="ic_assign_user_id" property="icAssignUserId"/>
<result column="relation_ic" property="relationIc"/>
<result column="relation_ic_rebate_ratio" property="relationIcRebateRatio"/>
<result column="relation_ic_time" property="relationIcTime"/>
<result column="relation_ic_user_id" property="relationIcUserId"/>
</resultMap> </resultMap>
<resultMap id="userExpandPO" type="cn.com.tenlion.operator.pojo.pos.user.expand.UserExpandPO"> <resultMap id="userExpandPO" type="cn.com.tenlion.operator.pojo.pos.user.expand.UserExpandPO">
@ -32,6 +41,15 @@
<result column="postpaid_count" property="postpaidCount"/> <result column="postpaid_count" property="postpaidCount"/>
<result column="free_proj_count" property="freeProjCount"/> <result column="free_proj_count" property="freeProjCount"/>
<result column="correction_count" property="correctionCount"/> <result column="correction_count" property="correctionCount"/>
<result column="ic" property="ic"/>
<result column="ic_rebate_ratio" property="icRebateRatio"/>
<result column="ic_way_to_get" property="icWayToGet"/>
<result column="ic_get_time" property="icGetTime"/>
<result column="ic_assign_user_id" property="icAssignUserId"/>
<result column="relation_ic" property="relationIc"/>
<result column="relation_ic_rebate_ratio" property="relationIcRebateRatio"/>
<result column="relation_ic_time" property="relationIcTime"/>
<result column="relation_ic_user_id" property="relationIcUserId"/>
</resultMap> </resultMap>
<insert id="save" parameterType="map"> <insert id="save" parameterType="map">
@ -48,7 +66,11 @@
postpaid, postpaid,
postpaid_count, postpaid_count,
free_proj_count, free_proj_count,
correction_count correction_count,
ic,
ic_rebate_ratio,
ic_get_time,
ic_assign_user_id
) VALUES ( ) VALUES (
#{userId}, #{userId},
#{priceAdditionalPkg}, #{priceAdditionalPkg},
@ -62,7 +84,11 @@
#{postpaid}, #{postpaid},
#{postpaidCount}, #{postpaidCount},
#{freeProjCount}, #{freeProjCount},
#{correctionCount} #{correctionCount},
#{ic},
#{icRebateRatio},
#{icGetTime},
#{icAssignUserId}
) )
</insert> </insert>
@ -70,6 +96,18 @@
UPDATE UPDATE
sys_user_expand sys_user_expand
SET SET
<if test="ic != null and ic != ''">
ic = #{ic},
</if>
<if test="icRebateRatio != null">
ic_rebate_ratio = #{icRebateRatio},
</if>
<if test="icGetTime != null and icGetTime != ''">
ic_get_time = #{icGetTime},
</if>
<if test="icAssignUserId != null and icAssignUserId != ''">
ic_assign_user_id = #{icAssignUserId},
</if>
price_additional_pkg = #{priceAdditionalPkg}, price_additional_pkg = #{priceAdditionalPkg},
price_additional_video_demo = #{priceAdditionalVideoDemo}, price_additional_video_demo = #{priceAdditionalVideoDemo},
price_additional_urgent = #{priceAdditionalUrgent}, price_additional_urgent = #{priceAdditionalUrgent},
@ -86,6 +124,29 @@
user_id = #{userId} user_id = #{userId}
</update> </update>
<update id="updateRelationIc" parameterType="map">
UPDATE
sys_user_expand
SET
price_all = #{priceAll},
price_material = #{priceMaterial},
relation_ic = #{relationIc},
relation_ic_rebate_ratio = #{relationIcRebateRatio},
relation_ic_time = #{relationIcTime},
relation_ic_user_id = #{relationIcUserId}
WHERE
user_id = #{userId}
</update>
<update id="updateRelationRebateRatio" parameterType="map">
UPDATE
sys_user_expand
SET
relation_ic_rebate_ratio = #{relationIcRebateRatio}
WHERE
relation_ic_user_id = #{relationIcUserId}
</update>
<select id="get" parameterType="map" resultMap="userExpandDTO"> <select id="get" parameterType="map" resultMap="userExpandDTO">
SELECT SELECT
price_additional_pkg, price_additional_pkg,
@ -99,7 +160,16 @@
postpaid, postpaid,
postpaid_count, postpaid_count,
free_proj_count, free_proj_count,
correction_count correction_count,
ic,
ic_rebate_ratio,
ic_way_to_get,
ic_get_time,
ic_assign_user_id,
relation_ic,
relation_ic_rebate_ratio,
relation_ic_time,
relation_ic_user_id
FROM FROM
sys_user_expand sys_user_expand
WHERE WHERE
@ -122,13 +192,43 @@
postpaid, postpaid,
postpaid_count, postpaid_count,
free_proj_count, free_proj_count,
correction_count correction_count,
ic,
ic_rebate_ratio,
ic_way_to_get,
ic_get_time,
ic_assign_user_id,
relation_ic,
relation_ic_rebate_ratio,
relation_ic_time,
relation_ic_user_id
FROM FROM
sys_user_expand sys_user_expand
WHERE WHERE
<if test="userId != null and userId != ''"> <if test="userId != null and userId != ''">
user_id = #{userId} user_id = #{userId}
</if> </if>
<if test="ic != null and ic != ''">
ic = #{ic}
</if>
</select>
<select id="countIc" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT
COUNT(ic)
FROM
sys_user_expand
WHERE
ic = #{_parameter}
</select>
<select id="listUserIdByRelationUserId" parameterType="java.lang.String" resultType="java.lang.String">
SELECT
user_id
FROM
sys_user_expand
WHERE
relation_ic_user_id = #{_parameter}
</select> </select>
</mapper> </mapper>

View File

@ -11,14 +11,14 @@
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all"> <link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
</head> </head>
<body> <body>
<div class="layui-fluid layui-anim layui-anim-fadein"> <div class="layui-anim layui-anim-fadein">
<div class="layui-row"> <div class="layui-row">
<div class="layui-col-md12"> <div class="layui-col-md12">
<div class="layui-card"> <div class="layui-card">
<div class="layui-card-body"> <div class="layui-card-body">
<div class="test-table-reload-btn" style="margin-bottom: 10px;"> <div class="test-table-reload-btn" style="margin-bottom: 10px;">
<div class="layui-inline"> <div class="layui-inline">
<input type="text" id="keywords" class="layui-input search-item" placeholder="输入关键字"> <input type="text" id="keywords" class="layui-input search-item" placeholder="输入描述关键字">
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
<input type="text" id="startTime" class="layui-input search-item" placeholder="开始时间" readonly> <input type="text" id="startTime" class="layui-input search-item" placeholder="开始时间" readonly>
@ -51,7 +51,8 @@
var laydate = layui.laydate; var laydate = layui.laydate;
var common = layui.common; var common = layui.common;
var resizeTimeout = null; var resizeTimeout = null;
var tableUrl = 'api/accountitem/listpage?accountId=[[${accountId}]]'; var query = top.restAjax.params(window.location.href);
var tableUrl = `api/accountitem/listpage?accountId=${query.accountId}`;
// 初始化表格 // 初始化表格
function initTable() { function initTable() {
@ -60,7 +61,7 @@
id: 'dataTable', id: 'dataTable',
url: top.restAjax.path(tableUrl, []), url: top.restAjax.path(tableUrl, []),
width: admin.screen() > 1 ? '100%' : '', width: admin.screen() > 1 ? '100%' : '',
height: $win.height() - 90, height: $win.height() - 60,
limit: 20, limit: 20,
limits: [20, 40, 60, 80, 100, 200], limits: [20, 40, 60, 80, 100, 200],
request: { request: {
@ -69,43 +70,72 @@
}, },
cols: [ cols: [
[ [
{type:'checkbox', fixed: 'left'}, {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_NUM}}</span>'},
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'}, {field: 'type', width: 100, title: '类型', align:'center', fixed: 'left',
{field: 'type', width: 180, title: '类型', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-'; return '-';
} }
if(rowData == 1) { if(rowData == 1) {
return '充值'; return '<span class="layui-badge layui-bg-green">充值</span>';
}else if(rowData == 2) { }else if(rowData == 2) {
return '支出'; return '<span class="layui-badge">支出</span>';
}else if(rowData == 3) { }else if(rowData == 3) {
return '提现'; return '<span class="layui-badge">提现</span>';
}else if(rowData == 4) { }else if(rowData == 4) {
return '系统扣款'; return '<span class="layui-badge">系统扣款</span>';
}else if(rowData == 5) { }else if(rowData == 5) {
return '入账'; return '<span class="layui-badge layui-bg-green">入账</span>';
} }
return rowData; return rowData;
} }
}, },
{field: 'accountMoneyDouble', width: 180, title: '本次金额', align:'center', {field: 'accountBeforeMoneyDouble', width: 120, title: '交易前金额', align:'center', fixed: 'left',
templet: function(row) {
var rowData = row[this.field];
return "<b>" + rowData + "</b>";
}
},
{field: 'accountMoneyDouble', width: 120, title: '交易金额', align:'center', fixed: 'left',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; var rowData = row[this.field];
var mode = row['mode']; var mode = row['mode'];
if (mode == 1) { if (mode === 1) {
return "<b style='color:red'>+" + rowData + "</b>"; return "<b> + " + rowData + "</b>";
}else{ }else{
return "<b style='color:green'>-" + rowData + "</b>"; return "<b> - " + rowData + "</b>";
} }
} }
}, },
{field: 'accountAfterMoneyDouble', width: 180, title: '本次余额', align:'center', {field: 'accountAfterMoneyDouble', width: 120, title: '交易后余额', align:'center', fixed: 'left',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; var rowData = row[this.field];
return "<b style='color:green'>" + rowData + "</b>"; return "<b>" + rowData + "</b>";
}
},
{field: 'orderId', width: 300, title: '关联订单编号', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'orderType', width: 120, title: '关联订单类型', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
if(rowData === 'ai') {
return 'AI秒著引擎'
}
if(rowData === 'agent') {
return '代理商平台'
}
return rowData;
} }
}, },
{field: 'gmtCreate', width: 180, title: '交易时间', align:'center', {field: 'gmtCreate', width: 180, title: '交易时间', align:'center',
@ -117,7 +147,7 @@
return rowData; return rowData;
} }
}, },
{field: 'description', width: 400, title: '描述', align:'center', {field: 'description', width: 600, title: '描述', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
@ -151,7 +181,6 @@
page: { page: {
curr: currentPage curr: currentPage
}, },
height: $win.height() - 90,
}); });
} }
// 初始化日期 // 初始化日期
@ -202,56 +231,9 @@
reloadTable(1); reloadTable(1);
}); });
// 事件 - 增删改 // 事件 - 增删改
table.on('toolbar(dataTable)', function(obj) { table.on('tool(dataTable)', function(obj) {
var layEvent = obj.event; var layEvent = obj.event;
var checkStatus = table.checkStatus('dataTable'); var dataObj = obj.data;
var checkDatas = checkStatus.data;
if(layEvent === 'saveEvent') {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/accountitem/save', []),
end: function() {
reloadTable();
}
});
} else if(layEvent === 'updateEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectEdit);
} else if(checkDatas.length > 1) {
top.dialog.msg(top.dataMessage.table.selectOneEdit);
} else {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/accountitem/update?accountItemId={accountItemId}', [checkDatas[0].accountItemId]),
end: function() {
reloadTable();
}
});
}
} else if(layEvent === 'removeEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectDelete);
} else {
var ids = '';
for(var i = 0, item; item = checkDatas[i++];) {
if(i > 1) {
ids += '_';
}
ids += item['accountItemId'];
}
removeData(ids);
}
}
}); });
}); });
</script> </script>

View File

@ -99,7 +99,7 @@
if(!item.account) { if(!item.account) {
return '-'; return '-';
} }
return `¥${(item.account.accountMoney / 100).toFixed(2)}`; return `<a href="javascript:void(0);" lay-event="accountItemEvent" style="font-weight: bold;">¥${(item.account.accountMoney / 100).toFixed(2)}</a>`;
} }
}, },
{field:'userInfoName', width:200, title: '用户/公司名称', align:'center', {field:'userInfoName', width:200, title: '用户/公司名称', align:'center',
@ -362,6 +362,19 @@
reloadTable(); reloadTable();
} }
}); });
} else if(layEvent === 'accountItemEvent') {
if(!dataObj.account) {
return;
}
top.dialog.open({
title: '【'+ dataObj.userName +'】资金流水',
url: `route/accountitem/list?accountId=${dataObj.account.accountId}`,
width: '80%',
height: '80%',
onClose: function() {
}
})
} else if(layEvent === 'operateEvent') { } else if(layEvent === 'operateEvent') {
var datas = [{ var datas = [{
id: 'resetPasswordEvent', id: 'resetPasswordEvent',

View File

@ -13,6 +13,8 @@
.layui-form-item {margin-bottom: 0;} .layui-form-item {margin-bottom: 0;}
.layui-form-label-new {width: 180px !important;} .layui-form-label-new {width: 180px !important;}
.layui-input-block-new {margin-left: 180px !important;} .layui-input-block-new {margin-left: 180px !important;}
.layui-input-block-new-center {margin-left: 180px !important; margin-right: 80px;}
.layui-form-btn {width: 80px; text-align: center; position: absolute; top: 0; right: 0; border-color: #eeeeee;}
.slide {width: 100%} .slide {width: 100%}
.slide .layui-slider {height: 38px;} .slide .layui-slider {height: 38px;}
.slide .layui-slider .layui-slider-step {height: 100%;} .slide .layui-slider .layui-slider-step {height: 100%;}
@ -23,7 +25,7 @@
<body> <body>
<div class="layui-anim layui-anim-fadein"> <div class="layui-anim layui-anim-fadein">
<div class="layui-card"> <div class="layui-card">
<div class="layui-card-body" style="padding: 15px;"> <div class="layui-card-body" style="padding: 15px 15px 35px 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm"> <form class="layui-form layui-form-pane" lay-filter="dataForm">
<blockquote class="layui-elem-quote">【项目价格设置】单位为<b>元(¥)</b>可保留两位小数如要使用系统默认金额设置为0即可</blockquote> <blockquote class="layui-elem-quote">【项目价格设置】单位为<b>元(¥)</b>可保留两位小数如要使用系统默认金额设置为0即可</blockquote>
<div class=" layui-row layui-col-space15"> <div class=" layui-row layui-col-space15">
@ -86,7 +88,7 @@
</div> </div>
</div> </div>
</div> </div>
<blockquote class="layui-elem-quote" style="margin-top: 15px;">其他设置</blockquote> <blockquote class="layui-elem-quote" style="margin-top: 15px;">项目其他设置</blockquote>
<div class=" layui-row layui-col-space15"> <div class=" layui-row layui-col-space15">
<div class="layui-col-xs6"> <div class="layui-col-xs6">
<div class="layui-form-item"> <div class="layui-form-item">
@ -137,6 +139,27 @@
</div> </div>
</div> </div>
</div> </div>
<blockquote class="layui-elem-quote" style="margin-top: 15px;">邀请码设置</blockquote>
<div class=" layui-row layui-col-space15">
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label layui-form-label-new">邀请码</label>
<div class="layui-input-block layui-input-block-new-center">
<input type="text" id="ic" name="ic" class="layui-input" placeholder="邀请码" maxlength="50" readonly>
</div>
<button type="button" class="layui-form-btn layui-btn layui-btn-primary" id="generateIc">生成</button>
</div>
</div>
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label layui-form-label-new">返利比率</label>
<div class="layui-input-block layui-input-block-new">
<input type="hidden" id="icRebateRatio" name="icRebateRatio">
<div id="icRebateRatioSlide" class="slide"></div>
</div>
</div>
</div>
</div>
<div class="layui-form-item layui-layout-admin"> <div class="layui-form-item layui-layout-admin">
<div class="layui-input-block"> <div class="layui-input-block">
<div class="layui-footer" style="left: 0;"> <div class="layui-footer" style="left: 0;">
@ -161,6 +184,26 @@
var slider = layui.slider; var slider = layui.slider;
var common = layui.common; var common = layui.common;
var userId = top.restAjax.params(window.location.href).userId; var userId = top.restAjax.params(window.location.href).userId;
var icRebateRatioSlide;
var $icRebateRatio = $('#icRebateRatio');
function generateIc() {
var loadLayerIndex;
top.restAjax.get(`api/user/expand/generate-ic`, {}, null, function(code, data) {
form.val('dataForm', {
ic: data.data
})
if(parseInt($icRebateRatio.val()) <= 0) {
icRebateRatioSlide.setValue(10);
}
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg('生成中...', {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
}
function init() { function init() {
var loadLayerIndex; var loadLayerIndex;
@ -184,6 +227,11 @@
} }
form.val('dataForm', dataFormData); form.val('dataForm', dataFormData);
form.render(null, 'dataForm'); form.render(null, 'dataForm');
if(data.ic) {
var $generateIc = $('#generateIc');
$generateIc.attr('disabled', 'disabled');
$generateIc.addClass('layui-btn-disabled')
}
slider.render({ slider.render({
elem: '#freeProjCountSlide', elem: '#freeProjCountSlide',
max: 10, max: 10,
@ -208,6 +256,18 @@
$('#correctionCount').val(value); $('#correctionCount').val(value);
} }
}) })
icRebateRatioSlide = slider.render({
elem: '#icRebateRatioSlide',
max: 50,
min: 0,
step: 1,
showstep: true,
value: data.icRebateRatio,
range: false,
change: function(value) {
$icRebateRatio.val(value);
}
})
}, function(code, data) { }, function(code, data) {
top.dialog.msg(data.msg); top.dialog.msg(data.msg);
}, function() { }, function() {
@ -222,7 +282,6 @@
top.dialog.confirm(top.dataMessage.commit, function(index) { top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index); top.dialog.close(index);
var loadLayerIndex; var loadLayerIndex;
console.log(formData.field)
var availableProjTypeArray = []; var availableProjTypeArray = [];
var postpaidArray = []; var postpaidArray = [];
for(var key in formData.field) { for(var key in formData.field) {
@ -269,6 +328,10 @@
closeBox(); closeBox();
}); });
$('#generateIc').click(function() {
generateIc();
})
// 校验 // 校验
form.verify({ form.verify({
}); });

View File

@ -44,65 +44,28 @@
<input type="text" readonly id="idCardNumber" name="idCardNumber" class="layui-input" value="" placeholder="证件号" maxlength="255" lay-verify="required"> <input type="text" readonly id="idCardNumber" name="idCardNumber" class="layui-input" value="" placeholder="证件号" maxlength="255" lay-verify="required">
</div> </div>
</div> </div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">证件照正反面:</label>
<div class="layui-input-block" id="idCardFrontBack"></div>
</div>
<div class="layui-row layui-col-space15">
<div class="layui-col-xs6">
<div class="layui-form-item" style="margin-bottom: 0">
<label class="layui-form-label" style="width: 120px">证件开始时间:</label>
<div class="layui-input-block" style="margin-left: 120px">
<input type="text" id="idCardStartDate" readonly name="idCardStartDate" class="layui-input" value="" placeholder="证件开始时间" maxlength="20">
</div>
</div>
</div>
<div class="layui-col-xs6">
<div class="layui-form-item" style="margin-bottom: 0">
<label class="layui-form-label" style="width: 120px">证件结束时间:</label>
<div class="layui-input-block" style="margin-left: 120px">
<input type="text" id="idCardEndDate" readonly name="idCardEndDate" class="layui-input" value="" placeholder="证件结束时间" maxlength="20">
</div>
</div>
</div>
</div>
<div id="enterpriseItemsContainer" style="display: none;">
<blockquote class="layui-elem-quote">企业信息</blockquote>
<div class="layui-row layui-col-space15">
<div class="layui-col-xs6">
<div class="layui-form-item" style="margin-bottom: 0">
<label class="layui-form-label">法人姓名:</label>
<div class="layui-input-block">
<input type="text" id="legalPerson" readonly name="legalPerson" class="layui-input" value="" placeholder="法人" maxlength="255">
</div>
</div>
</div>
<div class="layui-col-xs6">
<div class="layui-form-item" style="margin-bottom: 0">
<label class="layui-form-label">成立时间:</label>
<div class="layui-input-block">
<input type="text" id="establishDate" readonly name="establishDate" class="layui-input" value="" placeholder="成立时间" maxlength="20">
</div>
</div>
</div>
</div>
</div>
<div class="layui-row layui-col-space15">
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label">联系地址:</label>
<div class="layui-input-block">
<input type="text" id="contactAddress" readonly name="contactAddress" class="layui-input" value="" placeholder="联系地址" maxlength="255" lay-verify="required">
</div>
</div>
</div>
<div class="layui-col-xs6">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">联系电话:</label> <label class="layui-form-label">联系电话:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" id="contactPhone" readonly name="contactPhone" class="layui-input" value="" placeholder="联系电话" maxlength="255" lay-verify="required"> <input type="text" id="contactPhone" readonly name="contactPhone" class="layui-input" value="" placeholder="联系电话" maxlength="255" lay-verify="required">
</div> </div>
</div> </div>
<div class="layui-row layui-col-space15">
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label">联系人姓名:</label>
<div class="layui-input-block">
<input type="text" id="contactName" readonly name="contactName" class="layui-input" value="" placeholder="联系人姓名" maxlength="255" lay-verify="required">
</div>
</div>
</div>
<div class="layui-col-xs6">
<div class="layui-form-item">
<label class="layui-form-label" style="width: 120px;">联系人英文名:</label>
<div class="layui-input-block" style="margin-left: 120px;">
<input type="text" id="contactNameEn" readonly name="contactNameEn" class="layui-input" value="" placeholder="联系人英文名" maxlength="255" lay-verify="required">
</div>
</div>
</div> </div>
</div> </div>
<div class="layui-form-item layui-layout-admin"> <div class="layui-form-item layui-layout-admin">