剩余需求,此版本部分访问地址还是指向本地,下一版代码进行修改
This commit is contained in:
parent
fd8796c658
commit
d7e91a7faa
|
@ -118,8 +118,8 @@ public class AppLoginController {
|
||||||
@RequestMapping(value = "/registerCode", method = RequestMethod.POST)
|
@RequestMapping(value = "/registerCode", method = RequestMethod.POST)
|
||||||
@ApiOperation("app或h5注册或登录")
|
@ApiOperation("app或h5注册或登录")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Result registerCode( String phone, String msg,String platform, Integer sysPhone,String openId,String inviterCode,String bindingConsortiaId,String password,String userName,String avatar,String scanningChannel) {
|
public Result registerCode( String phone, String msg,String platform, Integer sysPhone,String openId,String inviterCode,String bindingConsortiaId,String password,String userName,String avatar,String scanningChannel,String blFxyCode,String blJjrCode,String blYwyCode,String blQdsCode,String blDlsCode) {
|
||||||
return userService.registerCode(phone,msg,platform,sysPhone,openId,inviterCode,bindingConsortiaId,password,userName,avatar,scanningChannel);
|
return userService.registerCode(phone,msg,platform,sysPhone,openId,inviterCode,bindingConsortiaId,password,userName,avatar,scanningChannel,blFxyCode,blJjrCode,blYwyCode,blQdsCode,blDlsCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("用户端发送验证码")
|
@ApiOperation("用户端发送验证码")
|
||||||
|
|
|
@ -134,14 +134,13 @@ public interface UserService extends IService<UserEntity> {
|
||||||
/**
|
/**
|
||||||
* app注册或h5注册
|
* app注册或h5注册
|
||||||
*
|
*
|
||||||
* @param pwd 密码
|
|
||||||
* @param phone 手机号
|
* @param phone 手机号
|
||||||
* @param msg 验证按
|
* @param msg 验证按
|
||||||
* @param platform 来源 app h5
|
* @param platform 来源 app h5
|
||||||
* @param scanningChannel
|
* @param scanningChannel
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Result registerCode(String phone, String msg, String platform, Integer sysPhone, String openId, String inviterCode, String bindingConsortiaId, String password, String userName, String avatar, String scanningChannel);
|
Result registerCode(String phone, String msg, String platform, Integer sysPhone, String openId, String inviterCode, String bindingConsortiaId, String password, String userName, String avatar, String scanningChannel,String blFxyCode,String blJjrCode,String blYwyCode,String blQdsCode,String blDlsCode);
|
||||||
|
|
||||||
|
|
||||||
Result loginByOpenId(String openId);
|
Result loginByOpenId(String openId);
|
||||||
|
|
|
@ -534,7 +534,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result registerCode(String phone, String msg, String platform, Integer sysPhone, String openId, String inviterCode, String bindingConsortiaId, String password, String userName, String avatar, String scanningChannel) {
|
public Result registerCode(String phone, String msg, String platform, Integer sysPhone, String openId, String inviterCode, String bindingConsortiaId, String password, String userName, String avatar, String scanningChannel,String blFxyCode,String blJjrCode,String blYwyCode,String blQdsCode,String blDlsCode) {
|
||||||
Msg msg1 = msgDao.findByPhoneAndCode(phone, msg);
|
Msg msg1 = msgDao.findByPhoneAndCode(phone, msg);
|
||||||
//校验短信验证码
|
//校验短信验证码
|
||||||
if (msg1 == null) {
|
if (msg1 == null) {
|
||||||
|
@ -581,6 +581,11 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||||
userInfo.setSysPhone(sysPhone);
|
userInfo.setSysPhone(sysPhone);
|
||||||
userInfo.setStatus(1);
|
userInfo.setStatus(1);
|
||||||
userInfo.setWxOpenId(openId);
|
userInfo.setWxOpenId(openId);
|
||||||
|
userInfo.setBlFxyCode(blFxyCode);
|
||||||
|
userInfo.setBlJjrCode(blJjrCode);
|
||||||
|
userInfo.setBlYwyCode(blYwyCode);
|
||||||
|
userInfo.setBlQdsCode(blQdsCode);
|
||||||
|
userInfo.setBlDlsCode(blDlsCode);
|
||||||
if(StringUtils.isNotEmpty(password)){
|
if(StringUtils.isNotEmpty(password)){
|
||||||
userInfo.setPassword(DigestUtils.sha256Hex(password));
|
userInfo.setPassword(DigestUtils.sha256Hex(password));
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,7 +217,7 @@ public class ArtificerController {
|
||||||
@PostMapping("/accomplishOrders")
|
@PostMapping("/accomplishOrders")
|
||||||
@ApiOperation("完成订单")
|
@ApiOperation("完成订单")
|
||||||
public Result accomplishOrders(Long ordersId){
|
public Result accomplishOrders(Long ordersId){
|
||||||
return ordersService.accomplishOrders(ordersId,1,null,null,null, null,null,null);
|
return ordersService.accomplishOrders(ordersId,1,null,null,null, null,null,null,null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -294,8 +294,8 @@ public class AppArtificerController {
|
||||||
|
|
||||||
@PostMapping("/accomplishOrders")
|
@PostMapping("/accomplishOrders")
|
||||||
@ApiOperation("完成订单")
|
@ApiOperation("完成订单")
|
||||||
public Result accomplishOrders(Long ordersId,String accomplishLongitude,String accomplishLatitude,String jsFwcn,String jsPjtag,String jsTsbz,String earlyFinishReason){
|
public Result accomplishOrders(Long ordersId,String accomplishLongitude,String accomplishLatitude,String jsFwcn,String jsPjtag,String jsTsbz,String earlyFinishReason,Integer adminOperation){
|
||||||
return ordersService.accomplishOrders(ordersId,2,accomplishLongitude,accomplishLatitude, jsFwcn, jsPjtag, jsTsbz,earlyFinishReason);
|
return ordersService.accomplishOrders(ordersId,2,accomplishLongitude,accomplishLatitude, jsFwcn, jsPjtag, jsTsbz,earlyFinishReason,adminOperation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/startOrders")
|
@PostMapping("/startOrders")
|
||||||
|
|
|
@ -69,4 +69,5 @@ public interface ArtificerDao extends BaseMapper<Artificer> {
|
||||||
|
|
||||||
void insertJfDetail(Long artificerId, String artificerName, Integer type, BigDecimal integral,String remarks);
|
void insertJfDetail(Long artificerId, String artificerName, Integer type, BigDecimal integral,String remarks);
|
||||||
|
|
||||||
|
int queryInServiceCount();
|
||||||
}
|
}
|
|
@ -160,4 +160,5 @@ public interface OrdersDao extends BaseMapper<Orders> {
|
||||||
|
|
||||||
Orders getOrdersMoneyById(Long ordersId);
|
Orders getOrdersMoneyById(Long ordersId);
|
||||||
|
|
||||||
|
List<Orders> gztddList();
|
||||||
}
|
}
|
|
@ -130,6 +130,11 @@ public class MassageType implements Serializable {
|
||||||
*/
|
*/
|
||||||
private Integer isTj;
|
private Integer isTj;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否推广0否1是
|
||||||
|
*/
|
||||||
|
private Integer isTg;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String ids;
|
private String ids;
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,16 @@ public class Orders implements Serializable {
|
||||||
*/
|
*/
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private BigDecimal fxyArtificerDeductMoneyTotal;
|
private BigDecimal fxyArtificerDeductMoneyTotal;
|
||||||
|
/**
|
||||||
|
* 渠道商分佣技师承担总金额
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal qdsArtificerDeductMoneyTotal;
|
||||||
|
/**
|
||||||
|
* 业务员分佣技师承担总金额
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal ywyArtificerDeductMoneyTotal;
|
||||||
/**
|
/**
|
||||||
* 总业绩
|
* 总业绩
|
||||||
*/
|
*/
|
||||||
|
@ -243,7 +252,14 @@ public class Orders implements Serializable {
|
||||||
* 加钟二级分销员分佣技师分担
|
* 加钟二级分销员分佣技师分担
|
||||||
*/
|
*/
|
||||||
private BigDecimal addFxyTwoArtificerDeductMoney;
|
private BigDecimal addFxyTwoArtificerDeductMoney;
|
||||||
|
/**
|
||||||
|
* 加钟渠道商分佣技师分担
|
||||||
|
*/
|
||||||
|
private BigDecimal addQdsArtificerDeductMoney;
|
||||||
|
/**
|
||||||
|
* 加钟业务员分佣技师分担
|
||||||
|
*/
|
||||||
|
private BigDecimal addYwyArtificerDeductMoney;
|
||||||
/**
|
/**
|
||||||
* 技师总收益
|
* 技师总收益
|
||||||
*/
|
*/
|
||||||
|
@ -692,5 +708,38 @@ public class Orders implements Serializable {
|
||||||
*/
|
*/
|
||||||
private BigDecimal fxyTwoArtificerDeductMoney;
|
private BigDecimal fxyTwoArtificerDeductMoney;
|
||||||
|
|
||||||
|
|
||||||
|
// 渠道商ID
|
||||||
|
private Long qdsUserId;
|
||||||
|
|
||||||
|
// 渠道商姓名
|
||||||
|
private String qdsUserName;
|
||||||
|
|
||||||
|
// 渠道商渠道码
|
||||||
|
private String qdsCode;
|
||||||
|
|
||||||
|
// 渠道码分佣
|
||||||
|
private BigDecimal qdsCodeMoney;
|
||||||
|
|
||||||
|
// 渠道商分佣技师承担金额
|
||||||
|
private BigDecimal qdsArtificerDeductMoney;
|
||||||
|
|
||||||
|
// 业务员ID
|
||||||
|
private Long ywyUserId;
|
||||||
|
|
||||||
|
// 业务员姓名
|
||||||
|
private String ywyUserName;
|
||||||
|
|
||||||
|
// 业务员分佣
|
||||||
|
private BigDecimal ywyCodeMoney;
|
||||||
|
|
||||||
|
// 业务员分佣技师承担金额
|
||||||
|
private BigDecimal ywyArtificerDeductMoney;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String ztName;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private int cs;
|
||||||
|
|
||||||
public Orders() {}
|
public Orders() {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,4 +59,8 @@ public interface ArtificerService extends IService<Artificer> {
|
||||||
Result getJfDetailList(Integer page,Integer limit,Long artificerId,String startTime,String endTime,Integer classify);
|
Result getJfDetailList(Integer page,Integer limit,Long artificerId,String startTime,String endTime,Integer classify);
|
||||||
|
|
||||||
void insertJfDetail(Long artificerId, String artificerName, Integer type, BigDecimal integral, String remarks);
|
void insertJfDetail(Long artificerId, String artificerName, Integer type, BigDecimal integral, String remarks);
|
||||||
|
|
||||||
|
int queryOnlineCount();
|
||||||
|
|
||||||
|
int queryInServiceCount();
|
||||||
}
|
}
|
|
@ -56,7 +56,7 @@ public interface OrdersService extends IService<Orders> {
|
||||||
|
|
||||||
Result payUserVip(Long userId,Long vipDetailsId);
|
Result payUserVip(Long userId,Long vipDetailsId);
|
||||||
|
|
||||||
Result accomplishOrders(Long ordersId,Integer type,String accomplishLongitude,String accomplishLatitude,String jsFwcn,String jsPjtag,String jsTsbz,String earlyFinishReason);
|
Result accomplishOrders(Long ordersId,Integer type,String accomplishLongitude,String accomplishLatitude,String jsFwcn,String jsPjtag,String jsTsbz,String earlyFinishReason,Integer adminOperation);
|
||||||
|
|
||||||
Result startOrders(Long ordersId,String startLongitude,String startLatitude,String startImg,String startRemark);
|
Result startOrders(Long ordersId,String startLongitude,String startLatitude,String startImg,String startRemark);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.sqx.modules.artificer.service.impl;
|
package com.sqx.modules.artificer.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateTime;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import com.alibaba.druid.util.StringUtils;
|
import com.alibaba.druid.util.StringUtils;
|
||||||
|
@ -28,19 +27,15 @@ import com.sqx.modules.bl.artificer.entity.ArtificerIntegralStatistics;
|
||||||
import com.sqx.modules.bl.artificer.service.ArtificerIntegralStatisticsService;
|
import com.sqx.modules.bl.artificer.service.ArtificerIntegralStatisticsService;
|
||||||
import com.sqx.modules.common.dao.CommonInfoDao;
|
import com.sqx.modules.common.dao.CommonInfoDao;
|
||||||
import com.sqx.modules.common.service.CommonInfoService;
|
import com.sqx.modules.common.service.CommonInfoService;
|
||||||
import com.sqx.modules.file.utils.FileUploadUtils;
|
|
||||||
import com.sqx.modules.message.entity.MessageInfo;
|
import com.sqx.modules.message.entity.MessageInfo;
|
||||||
import com.sqx.modules.message.service.MessageService;
|
import com.sqx.modules.message.service.MessageService;
|
||||||
import com.sqx.modules.pay.dao.CashOutDao;
|
import com.sqx.modules.pay.dao.CashOutDao;
|
||||||
import com.sqx.modules.sys.entity.SysDictEntity;
|
import com.sqx.modules.sys.entity.SysDictEntity;
|
||||||
import com.sqx.modules.sys.service.SysDictService;
|
import com.sqx.modules.sys.service.SysDictService;
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.text.ParseException;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -1246,5 +1241,15 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int queryOnlineCount(){
|
||||||
|
QueryWrapper<Artificer> artificerQueryWrapper = new QueryWrapper<>();
|
||||||
|
artificerQueryWrapper.eq("status",1);
|
||||||
|
return baseMapper.selectCount(artificerQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int queryInServiceCount(){
|
||||||
|
return baseMapper.queryInServiceCount();
|
||||||
|
}
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.sqx.common.utils.Result;
|
import com.sqx.common.utils.Result;
|
||||||
import com.sqx.modules.app.annotation.Login;
|
import com.sqx.modules.app.annotation.Login;
|
||||||
|
import com.sqx.modules.app.dao.UserDao;
|
||||||
|
import com.sqx.modules.app.entity.UserEntity;
|
||||||
import com.sqx.modules.bl.commission.fxy.entity.FxyApply;
|
import com.sqx.modules.bl.commission.fxy.entity.FxyApply;
|
||||||
import com.sqx.modules.bl.commission.fxy.entity.FxyConfig;
|
import com.sqx.modules.bl.commission.fxy.entity.FxyConfig;
|
||||||
import com.sqx.modules.bl.commission.fxy.entity.FxyData;
|
import com.sqx.modules.bl.commission.fxy.entity.FxyData;
|
||||||
|
@ -38,6 +40,9 @@ public class AppFxyController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private FxyDataService dataService;
|
private FxyDataService dataService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserDao userDao;
|
||||||
|
|
||||||
@GetMapping("/fxyConfig")
|
@GetMapping("/fxyConfig")
|
||||||
@ApiOperation("获取分销员配置")
|
@ApiOperation("获取分销员配置")
|
||||||
public Result fxyConfig(){
|
public Result fxyConfig(){
|
||||||
|
@ -58,6 +63,10 @@ public class AppFxyController {
|
||||||
fxyApply.setOpinion("自动通过");
|
fxyApply.setOpinion("自动通过");
|
||||||
fxyApply.setApproveTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
fxyApply.setApproveTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||||
service.updateByUserId(fxyApply);
|
service.updateByUserId(fxyApply);
|
||||||
|
//更新user表状态
|
||||||
|
UserEntity userEntity = userDao.selectById(fxyApply.getUserId());
|
||||||
|
userEntity.setBlIsFxy(1);
|
||||||
|
userDao.updateById(userEntity);
|
||||||
return Result.success("申请成功,请重新登录");
|
return Result.success("申请成功,请重新登录");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,7 @@ public class FxyDataServiceImpl extends ServiceImpl<FxyDataDao, FxyData> impleme
|
||||||
result.put("userCount",fxyData.getUserCount());//累计粉丝
|
result.put("userCount",fxyData.getUserCount());//累计粉丝
|
||||||
result.put("name",fxyData.getName());//姓名
|
result.put("name",fxyData.getName());//姓名
|
||||||
result.put("level",fxyData.getBlFxyLevel());//等级
|
result.put("level",fxyData.getBlFxyLevel());//等级
|
||||||
|
result.put("createTime",fxyData.getCreateTime());//加入时间
|
||||||
return Result.success().put("data",result);
|
return Result.success().put("data",result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.sqx.modules.bl.commission.qds.controller;
|
||||||
|
|
||||||
|
import com.sqx.common.utils.Result;
|
||||||
|
import com.sqx.modules.bl.commission.qds.entity.QdsCode;
|
||||||
|
import com.sqx.modules.bl.commission.qds.entity.QdsCodeRecord;
|
||||||
|
import com.sqx.modules.bl.commission.qds.service.QdsCodeRecordService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/commission/qdsCodeRecord")
|
||||||
|
@Api(value = "分佣管理", tags = {"渠道商渠道码扫码记录"})
|
||||||
|
public class QdsCodeRecordController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private QdsCodeRecordService qdsCodeRecordService;
|
||||||
|
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ApiOperation("添加")
|
||||||
|
public Result add(QdsCodeRecord qdsCodeRecord){
|
||||||
|
qdsCodeRecordService.add(qdsCodeRecord);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -3,17 +3,12 @@ package com.sqx.modules.bl.commission.qds.controller.app;
|
||||||
import com.sqx.common.utils.Result;
|
import com.sqx.common.utils.Result;
|
||||||
import com.sqx.modules.app.annotation.Login;
|
import com.sqx.modules.app.annotation.Login;
|
||||||
import com.sqx.modules.bl.commission.qds.entity.QdsApply;
|
import com.sqx.modules.bl.commission.qds.entity.QdsApply;
|
||||||
import com.sqx.modules.bl.commission.qds.service.QdsApplyService;
|
import com.sqx.modules.bl.commission.qds.entity.QdsCodeRecord;
|
||||||
import com.sqx.modules.bl.commission.qds.service.QdsCodeService;
|
import com.sqx.modules.bl.commission.qds.service.*;
|
||||||
import com.sqx.modules.bl.commission.qds.service.QdsDataService;
|
|
||||||
import com.sqx.modules.bl.commission.qds.service.QdsLmService;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestAttribute;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -35,6 +30,9 @@ public class AppQdsController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private QdsCodeService codeService;
|
private QdsCodeService codeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private QdsCodeRecordService qdsCodeRecordService;
|
||||||
|
|
||||||
@GetMapping("/lmList")
|
@GetMapping("/lmList")
|
||||||
@ApiOperation("类目列表")
|
@ApiOperation("类目列表")
|
||||||
public Result lmList(){
|
public Result lmList(){
|
||||||
|
@ -75,4 +73,11 @@ public class AppQdsController {
|
||||||
public Result myQds(@RequestAttribute Long userId){
|
public Result myQds(@RequestAttribute Long userId){
|
||||||
return dataService.myQds(userId);
|
return dataService.myQds(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/addCodeRecord")
|
||||||
|
@ApiOperation("添加")
|
||||||
|
public Result addCodeRecord(QdsCodeRecord qdsCodeRecord){
|
||||||
|
qdsCodeRecordService.add(qdsCodeRecord);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.sqx.modules.bl.commission.qds.dao;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.sqx.modules.bl.commission.qds.entity.QdsCodeRecord;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface QdsCodeRecordDao extends BaseMapper<QdsCodeRecord> {
|
||||||
|
String queryScanCodeRecord(@Param("userId") Long userId);
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.sqx.modules.bl.commission.qds.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description bl_qds_code_record
|
||||||
|
* 渠道商渠道码扫码记录表
|
||||||
|
* @author zmy
|
||||||
|
* @date 2025-02-25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("bl_qds_code_record")
|
||||||
|
public class QdsCodeRecord implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*用户ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*编码
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*更新时间
|
||||||
|
*/
|
||||||
|
private String isNew;
|
||||||
|
|
||||||
|
public QdsCodeRecord() {}
|
||||||
|
}
|
|
@ -66,10 +66,34 @@ public class QdsData implements Serializable {
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private BigDecimal rate;
|
private BigDecimal rate;
|
||||||
/**
|
/**
|
||||||
*扫码数量
|
*新用户扫码数量
|
||||||
*/
|
*/
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Integer smCount;
|
private Integer xyhsmsl;
|
||||||
|
/**
|
||||||
|
*老用户扫码数量
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer lyhsmsl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*有效注册平台数
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer yxzcpts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*渠道商分佣
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal qdsfy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*总金额
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal zje;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*当日成交订单数量
|
*当日成交订单数量
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.sqx.modules.bl.commission.qds.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.sqx.modules.bl.commission.qds.entity.QdsCodeRecord;
|
||||||
|
|
||||||
|
public interface QdsCodeRecordService extends IService<QdsCodeRecord> {
|
||||||
|
int add(QdsCodeRecord qdsCodeRecord);
|
||||||
|
|
||||||
|
String queryScanCodeRecord(Long userId);
|
||||||
|
}
|
|
@ -10,4 +10,5 @@ public interface QdsCodeService extends IService<QdsCode> {
|
||||||
int update(QdsCode qdsCode);
|
int update(QdsCode qdsCode);
|
||||||
Result findUserPage(QdsCode qdsCode);
|
Result findUserPage(QdsCode qdsCode);
|
||||||
|
|
||||||
|
QdsCode queryQdmInfo(String code);
|
||||||
}
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.sqx.modules.bl.commission.qds.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.sqx.modules.app.entity.UserEntity;
|
||||||
|
import com.sqx.modules.app.service.UserService;
|
||||||
|
import com.sqx.modules.bl.commission.qds.dao.QdsCodeRecordDao;
|
||||||
|
import com.sqx.modules.bl.commission.qds.entity.QdsCodeRecord;
|
||||||
|
import com.sqx.modules.bl.commission.qds.service.QdsCodeRecordService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class DqsCodeRecordServiceImpl extends ServiceImpl<QdsCodeRecordDao, QdsCodeRecord> implements QdsCodeRecordService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private QdsCodeRecordDao qdsCodeRecordDao;
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int add(QdsCodeRecord qdsCodeRecord) {
|
||||||
|
UserEntity userEntity = userService.selectUserById(qdsCodeRecord.getUserId());
|
||||||
|
String createTimeStr = userEntity.getCreateTime();
|
||||||
|
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
LocalDateTime createTime = LocalDateTime.parse(createTimeStr, formatter);
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
// 注册时间不满5分钟视为新用户
|
||||||
|
long minutesDifference = java.time.Duration.between(createTime, now).toMinutes();
|
||||||
|
if (minutesDifference <= 5) {
|
||||||
|
qdsCodeRecord.setIsNew("Y");
|
||||||
|
} else {
|
||||||
|
qdsCodeRecord.setIsNew("N");
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseMapper.insert(qdsCodeRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String queryScanCodeRecord(Long userId) {
|
||||||
|
return qdsCodeRecordDao.queryScanCodeRecord(userId);
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package com.sqx.modules.bl.commission.qds.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.extra.qrcode.QrCodeUtil;
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.sqx.common.utils.PageUtils;
|
import com.sqx.common.utils.PageUtils;
|
||||||
|
@ -76,4 +77,9 @@ public class DqsCodeServiceImpl extends ServiceImpl<QdsCodeDao, QdsCode> impleme
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public QdsCode queryQdmInfo(String code){
|
||||||
|
QueryWrapper<QdsCode> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("code",code);
|
||||||
|
return baseMapper.selectOne(queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -49,6 +49,10 @@ public class YwyConfig implements Serializable {
|
||||||
*业务员与渠道商分佣方式
|
*业务员与渠道商分佣方式
|
||||||
*/
|
*/
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
/**
|
||||||
|
*抽成比例
|
||||||
|
*/
|
||||||
|
private BigDecimal ccbl;
|
||||||
/**
|
/**
|
||||||
*邀请业务员推广海报背景图
|
*邀请业务员推广海报背景图
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
package com.sqx.modules.bl.dashboard;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.sqx.common.utils.Result;
|
||||||
|
import com.sqx.modules.app.service.UserService;
|
||||||
|
import com.sqx.modules.artificer.dao.OrdersDao;
|
||||||
|
import com.sqx.modules.artificer.entity.Orders;
|
||||||
|
import com.sqx.modules.artificer.service.ArtificerService;
|
||||||
|
import com.sqx.modules.message.entity.MessageInfo;
|
||||||
|
import com.sqx.modules.message.service.MessageService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zmy
|
||||||
|
* @date 2025/2/27
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Api(value = "驾驶舱", tags = {"驾驶舱"})
|
||||||
|
@RequestMapping(value = "/dashboard")
|
||||||
|
public class DashBoardController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
@Autowired
|
||||||
|
private OrdersDao ordersDao;
|
||||||
|
@Autowired
|
||||||
|
private ArtificerService artificerService;
|
||||||
|
@Autowired
|
||||||
|
private MessageService messageService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据统计"
|
||||||
|
*/
|
||||||
|
@GetMapping("/dataQuery")
|
||||||
|
@ApiOperation("数据统计")
|
||||||
|
public Result dataQuery(){
|
||||||
|
String dateStr = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||||
|
//今日订单数量
|
||||||
|
int jr_ddsl = ordersDao.selectCountOrders(dateStr, 1, null);
|
||||||
|
//本月订单数量
|
||||||
|
int by_ddsl = ordersDao.selectCountOrders(dateStr, 2, null);
|
||||||
|
//今日新增用户数量
|
||||||
|
int jr_xzyhsl = userService.queryUserCount(1, null,null,null);
|
||||||
|
//本月新增用户数量
|
||||||
|
int by_xzyhsl = userService.queryUserCount(2, null,null,null);
|
||||||
|
//今日营收
|
||||||
|
BigDecimal jr_ys = ordersDao.selectOrdersMoney(dateStr, 1, 1);
|
||||||
|
//本月营收
|
||||||
|
BigDecimal by_ys = ordersDao.selectOrdersMoney(dateStr, 2, 1);
|
||||||
|
//技师总数
|
||||||
|
int jszs = userService.queryUserCount(0, null,2,null);
|
||||||
|
//在线技师总数
|
||||||
|
int zxjszs = artificerService.queryOnlineCount();
|
||||||
|
//服务中技师总数
|
||||||
|
int fwzjszs = artificerService.queryInServiceCount();
|
||||||
|
//投诉统计
|
||||||
|
List<MessageInfo> tsList = messageService.queryComplaints();
|
||||||
|
//各状态订单统计
|
||||||
|
List<Orders> gztddList = ordersDao.gztddList();
|
||||||
|
//技师排行
|
||||||
|
IPage<Map<String,Object>> pageList = ordersDao.selectArtificerMoneyList(new Page<>(1,-1),null,null,null,6);
|
||||||
|
List<Map<String, Object>> jsph = pageList.getRecords();
|
||||||
|
Map<String,Object> result=new HashMap<>();
|
||||||
|
result.put("jr_ddsl",jr_ddsl);
|
||||||
|
result.put("by_ddsl",by_ddsl);
|
||||||
|
result.put("jr_xzyhsl",jr_xzyhsl);
|
||||||
|
result.put("by_xzyhsl",by_xzyhsl);
|
||||||
|
result.put("jr_ys",jr_ys.setScale(2,BigDecimal.ROUND_DOWN));
|
||||||
|
result.put("by_ys",by_ys.setScale(2,BigDecimal.ROUND_DOWN));
|
||||||
|
result.put("jszs",jszs);
|
||||||
|
result.put("zxjszs",zxjszs);
|
||||||
|
result.put("fwzjszs",fwzjszs);
|
||||||
|
result.put("tsList",tsList);
|
||||||
|
result.put("gztddList",gztddList);
|
||||||
|
result.put("jsph",jsph);
|
||||||
|
return Result.success().put("data",result);
|
||||||
|
}
|
||||||
|
}
|
|
@ -66,6 +66,12 @@ public class MassagePackageController {
|
||||||
service.updateTj(massagePackage);
|
service.updateTj(massagePackage);
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
@PostMapping("/updateTg")
|
||||||
|
@ApiOperation("修改推荐")
|
||||||
|
public Result updateTg(MassagePackage massagePackage){
|
||||||
|
service.updateTg(massagePackage);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/updateStatus")
|
@PostMapping("/updateStatus")
|
||||||
@ApiOperation("修改状态")
|
@ApiOperation("修改状态")
|
||||||
|
|
|
@ -17,6 +17,7 @@ public interface MassagePackageDao extends BaseMapper<MassagePackage> {
|
||||||
int updateVip(MassagePackage massagePackage);
|
int updateVip(MassagePackage massagePackage);
|
||||||
int updateNewer(MassagePackage massagePackage);
|
int updateNewer(MassagePackage massagePackage);
|
||||||
int updateTj(MassagePackage massagePackage);
|
int updateTj(MassagePackage massagePackage);
|
||||||
|
int updateTg(MassagePackage massagePackage);
|
||||||
int updateStatus(MassagePackage massagePackage);
|
int updateStatus(MassagePackage massagePackage);
|
||||||
int updatePrice(MassagePackage massagePackage);
|
int updatePrice(MassagePackage massagePackage);
|
||||||
int delete(MassagePackage massagePackage);
|
int delete(MassagePackage massagePackage);
|
||||||
|
|
|
@ -166,6 +166,11 @@ public class MassagePackage implements Serializable {
|
||||||
*/
|
*/
|
||||||
private Integer isTj;
|
private Integer isTj;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否推广0否1是
|
||||||
|
*/
|
||||||
|
private Integer isTg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务次数
|
* 服务次数
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,6 +13,7 @@ public interface MassagePackageService extends IService<MassagePackage> {
|
||||||
int updateVip(MassagePackage massagePackage);
|
int updateVip(MassagePackage massagePackage);
|
||||||
int updateNewer(MassagePackage massagePackage);
|
int updateNewer(MassagePackage massagePackage);
|
||||||
int updateTj(MassagePackage massagePackage);
|
int updateTj(MassagePackage massagePackage);
|
||||||
|
int updateTg(MassagePackage massagePackage);
|
||||||
int updateStatus(MassagePackage massagePackage);
|
int updateStatus(MassagePackage massagePackage);
|
||||||
int updatePrice(MassagePackage massagePackage);
|
int updatePrice(MassagePackage massagePackage);
|
||||||
int delete(MassagePackage massagePackage);
|
int delete(MassagePackage massagePackage);
|
||||||
|
|
|
@ -84,6 +84,11 @@ public class MassagePackageServiceImpl extends ServiceImpl<MassagePackageDao, Ma
|
||||||
public int updateTj(MassagePackage massagePackage){
|
public int updateTj(MassagePackage massagePackage){
|
||||||
return baseMapper.updateTj(massagePackage);
|
return baseMapper.updateTj(massagePackage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateTg(MassagePackage massagePackage){
|
||||||
|
return baseMapper.updateTg(massagePackage);
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public int updateStatus(MassagePackage massagePackage){
|
public int updateStatus(MassagePackage massagePackage){
|
||||||
return baseMapper.updateStatus(massagePackage);
|
return baseMapper.updateStatus(massagePackage);
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.sqx.modules.coupon.service.CouponService;
|
||||||
import com.sqx.modules.sys.controller.AbstractController;
|
import com.sqx.modules.sys.controller.AbstractController;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
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.*;
|
||||||
|
|
||||||
|
@ -53,4 +54,13 @@ public class CouponController extends AbstractController {
|
||||||
return couponService.giveCoupon(couponId, userIdList, shopId,amount);
|
return couponService.giveCoupon(couponId, userIdList, shopId,amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/selectListByType")
|
||||||
|
@ApiOperation("按照类型查询物料包列表")
|
||||||
|
public Result selectListByType(
|
||||||
|
@ApiParam("商品标题:可搜索")@RequestParam(required = false) String title,
|
||||||
|
@ApiParam("商品类型:类型名称")@RequestParam(required = false) String type,
|
||||||
|
@ApiParam("商品状态:0全部 1上架 2下架")@RequestParam(required = false) Integer status,
|
||||||
|
@ApiParam("是否积分商品:1积分商城商品")@RequestParam(required = false) Integer isJiFenGoods) {
|
||||||
|
return couponService.selectListByType(title, type, status, isJiFenGoods);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,17 +7,23 @@ import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ApiModel("coupon")
|
@ApiModel("coupon")
|
||||||
|
@Entity
|
||||||
public class Coupon implements Serializable {
|
public class Coupon implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@TableId(type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
|
|
||||||
|
@Id()
|
||||||
@ApiModelProperty("coupon_id")
|
@ApiModelProperty("coupon_id")
|
||||||
private Long couponId;
|
private Long couponId;
|
||||||
|
|
||||||
|
@ -50,5 +56,14 @@ public class Coupon implements Serializable {
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String classifyName;
|
private String classifyName;
|
||||||
|
|
||||||
|
/** 商品id */
|
||||||
|
@ApiModelProperty("商品ID")
|
||||||
|
@JoinColumn(name = "goods_id")
|
||||||
|
private Integer goodsId;
|
||||||
|
|
||||||
|
/** 商品名称 */
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String goodsName;
|
||||||
|
|
||||||
public Coupon() {}
|
public Coupon() {}
|
||||||
}
|
}
|
|
@ -20,4 +20,5 @@ public interface CouponService extends IService<Coupon> {
|
||||||
|
|
||||||
Result giveCoupon(Long couponId, List<String> userIdList, Long shopId, Integer amount);
|
Result giveCoupon(Long couponId, List<String> userIdList, Long shopId, Integer amount);
|
||||||
|
|
||||||
|
Result selectListByType(String title, String type, Integer status, Integer isJiFenGoods);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.sqx.common.utils.Result;
|
import com.sqx.common.utils.Result;
|
||||||
import com.sqx.modules.app.entity.UserEntity;
|
import com.sqx.modules.app.entity.UserEntity;
|
||||||
import com.sqx.modules.coupon.entity.CouponUser;
|
import com.sqx.modules.coupon.entity.CouponUser;
|
||||||
|
import com.sqx.modules.shopping.entity.SelfGoods;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@ -17,6 +18,8 @@ public interface CouponUserService extends IService<CouponUser> {
|
||||||
|
|
||||||
Result buyCoupon(Long userId, Long couponId);
|
Result buyCoupon(Long userId, Long couponId);
|
||||||
|
|
||||||
|
Result buyShopCoupon(Long userId, Long goodsId);
|
||||||
|
|
||||||
Result selectCouponByUserId(Integer page, Integer limit, String id, Long userId, Integer status, String phone,String couponName);
|
Result selectCouponByUserId(Integer page, Integer limit, String id, Long userId, Integer status, String phone,String couponName);
|
||||||
|
|
||||||
Result selectNewUserCoupon(Integer page,Integer limit);
|
Result selectNewUserCoupon(Integer page,Integer limit);
|
||||||
|
|
|
@ -1,21 +1,33 @@
|
||||||
package com.sqx.modules.coupon.service.impl;
|
package com.sqx.modules.coupon.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import com.sqx.common.utils.PageUtils;
|
import com.sqx.common.utils.PageUtils;
|
||||||
import com.sqx.common.utils.Result;
|
import com.sqx.common.utils.Result;
|
||||||
import com.sqx.modules.coupon.dao.CouponDao;
|
import com.sqx.modules.coupon.dao.CouponDao;
|
||||||
import com.sqx.modules.coupon.dao.CouponUserDao;
|
import com.sqx.modules.coupon.dao.CouponUserDao;
|
||||||
import com.sqx.modules.coupon.entity.Coupon;
|
import com.sqx.modules.coupon.entity.Coupon;
|
||||||
import com.sqx.modules.coupon.service.CouponService;
|
import com.sqx.modules.coupon.service.CouponService;
|
||||||
|
import com.sqx.modules.shopping.dao.GoodsJpaRepository;
|
||||||
|
import com.sqx.modules.shopping.dao.GoodsTypeJpaRepository;
|
||||||
|
import com.sqx.modules.shopping.entity.GoodsType;
|
||||||
|
import com.sqx.modules.shopping.entity.SelfGoods;
|
||||||
|
import com.sqx.modules.shopping.utils.ResultUtil;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
|
import javax.persistence.criteria.Predicate;
|
||||||
|
import javax.persistence.criteria.Root;
|
||||||
|
import javax.persistence.criteria.Subquery;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class CouponServiceImpl extends ServiceImpl<CouponDao, Coupon> implements CouponService {
|
public class CouponServiceImpl extends ServiceImpl<CouponDao, Coupon> implements CouponService {
|
||||||
|
@ -24,13 +36,17 @@ public class CouponServiceImpl extends ServiceImpl<CouponDao, Coupon> implements
|
||||||
private CouponDao couponDao;
|
private CouponDao couponDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CouponUserDao couponUserDao;
|
private CouponUserDao couponUserDao;
|
||||||
|
@Autowired
|
||||||
|
private GoodsTypeJpaRepository goodsJpaTypeRepository;
|
||||||
|
@Autowired
|
||||||
|
private GoodsJpaRepository jpaRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result selectAllCoupon(Integer page, Integer limit) {
|
public Result selectAllCoupon(Integer page, Integer limit) {
|
||||||
if(page == null || limit==null){
|
if (page == null || limit == null) {
|
||||||
List<Coupon> coupons = baseMapper.selectCouponList();
|
List<Coupon> coupons = baseMapper.selectCouponList();
|
||||||
return Result.success().put("data",coupons);
|
return Result.success().put("data", coupons);
|
||||||
}else{
|
} else {
|
||||||
Page<Coupon> pages = new Page<>(page, limit);
|
Page<Coupon> pages = new Page<>(page, limit);
|
||||||
PageUtils pageUtils = new PageUtils(baseMapper.selectCouponPage(pages));
|
PageUtils pageUtils = new PageUtils(baseMapper.selectCouponPage(pages));
|
||||||
return Result.success().put("data", pageUtils);
|
return Result.success().put("data", pageUtils);
|
||||||
|
@ -46,14 +62,18 @@ public class CouponServiceImpl extends ServiceImpl<CouponDao, Coupon> implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result updateCoupon(Coupon coupon) {
|
public Result updateCoupon(Coupon coupon) {
|
||||||
|
if (coupon.getGoodsId() == null) {
|
||||||
|
couponDao.update(coupon, new UpdateWrapper<Coupon>().set("goods_id", null).eq("coupon_id", coupon.getCouponId()));
|
||||||
|
} else {
|
||||||
couponDao.updateById(coupon);
|
couponDao.updateById(coupon);
|
||||||
|
}
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result selectCouponList(Integer page, Integer limit) {
|
public Result selectCouponList(Integer page, Integer limit) {
|
||||||
Page<Coupon> pages = new Page<>(page, limit);
|
Page<Coupon> pages = new Page<>(page, limit);
|
||||||
PageUtils pageUtils = new PageUtils(baseMapper.selectPage(pages,null));
|
PageUtils pageUtils = new PageUtils(baseMapper.selectPage(pages, null));
|
||||||
return Result.success().put("data", pageUtils);
|
return Result.success().put("data", pageUtils);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +90,7 @@ public class CouponServiceImpl extends ServiceImpl<CouponDao, Coupon> implements
|
||||||
Date date = calendar.getTime();
|
Date date = calendar.getTime();
|
||||||
String createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
String createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||||
String expirationTime = new SimpleDateFormat("yyyy-MM-dd").format(date);
|
String expirationTime = new SimpleDateFormat("yyyy-MM-dd").format(date);
|
||||||
if(amount == null) amount = 3;
|
if (amount == null) amount = 3;
|
||||||
for (Integer i = 0; i < amount; i++) {
|
for (Integer i = 0; i < amount; i++) {
|
||||||
couponUserDao.giveCoupon(userIdList, coupon.getCouponName(), coupon.getCouponPicture(), createTime, expirationTime, coupon.getMinMoney(),
|
couponUserDao.giveCoupon(userIdList, coupon.getCouponName(), coupon.getCouponPicture(), createTime, expirationTime, coupon.getMinMoney(),
|
||||||
coupon.getMoney(), 0, coupon.getEndDate().toString());
|
coupon.getMoney(), 0, coupon.getEndDate().toString());
|
||||||
|
@ -84,5 +104,82 @@ public class CouponServiceImpl extends ServiceImpl<CouponDao, Coupon> implements
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result selectListByType(String title, String type, Integer status, Integer isJiFenGoods) {
|
||||||
|
//构造自定义查询条件
|
||||||
|
Specification<GoodsType> queryCondition1 = (root, criteriaQuery, criteriaBuilder) -> {
|
||||||
|
List<Predicate> predicateList = new ArrayList<>();
|
||||||
|
predicateList.add(criteriaBuilder.or(criteriaBuilder.equal(root.get("parentId"), "57"), criteriaBuilder.equal(root.get("id"), "57")));
|
||||||
|
return criteriaBuilder.and(predicateList.toArray(new Predicate[0]));
|
||||||
|
};
|
||||||
|
List<GoodsType> materialTypes = goodsJpaTypeRepository.findAll(queryCondition1);
|
||||||
|
// Specification<SelfGoods> queryCondition = (root, criteriaQuery, criteriaBuilder) -> {
|
||||||
|
// List<Predicate> predicateList = new ArrayList<>();
|
||||||
|
// if (StringUtils.isNotEmpty(title)) {
|
||||||
|
// predicateList.add(criteriaBuilder.like(root.get("title"), "%" + title + "%"));
|
||||||
|
// }
|
||||||
|
// CriteriaBuilder.In<Object> in = criteriaBuilder.in(root.get("typeId"));
|
||||||
|
// for (GoodsType goodsType : materialTypes) {
|
||||||
|
// in.value(goodsType.getId());
|
||||||
|
// }
|
||||||
|
// predicateList.add(in);
|
||||||
|
// if (ObjectUtil.isNotEmpty(status)) {
|
||||||
|
// predicateList.add(criteriaBuilder.equal(root.get("status"), status));
|
||||||
|
// }
|
||||||
|
// if (ObjectUtil.isNotEmpty(isJiFenGoods)) {
|
||||||
|
// predicateList.add(criteriaBuilder.equal(root.get("isJiFenGoods"), isJiFenGoods));
|
||||||
|
// } else {
|
||||||
|
// predicateList.add(criteriaBuilder.isNull(root.get("isJiFenGoods")));
|
||||||
|
// }
|
||||||
|
// return criteriaBuilder.and(predicateList.toArray(new Predicate[0]));
|
||||||
|
// };
|
||||||
|
Specification<SelfGoods> queryCondition = (root, criteriaQuery, criteriaBuilder) -> {
|
||||||
|
List<Predicate> predicateList = new ArrayList<>();
|
||||||
|
|
||||||
|
// 原有的查询条件保持不变
|
||||||
|
if (StringUtils.isNotEmpty(title)) {
|
||||||
|
predicateList.add(criteriaBuilder.like(root.get("title"), "%" + title + "%"));
|
||||||
|
}
|
||||||
|
CriteriaBuilder.In<Object> in = criteriaBuilder.in(root.get("typeId"));
|
||||||
|
for (GoodsType goodsType : materialTypes) {
|
||||||
|
in.value(goodsType.getId());
|
||||||
|
}
|
||||||
|
predicateList.add(in);
|
||||||
|
if (ObjectUtil.isNotEmpty(status)) {
|
||||||
|
predicateList.add(criteriaBuilder.equal(root.get("status"), status));
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(isJiFenGoods)) {
|
||||||
|
predicateList.add(criteriaBuilder.equal(root.get("isJiFenGoods"), isJiFenGoods));
|
||||||
|
} else {
|
||||||
|
predicateList.add(criteriaBuilder.isNull(root.get("isJiFenGoods")));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 子查询:从Coupon表中选择所有goods_id,并且goodsId is not null
|
||||||
|
Subquery<Long> subquery = criteriaQuery.subquery(Long.class);
|
||||||
|
Root<Coupon> couponRoot = subquery.from(Coupon.class);
|
||||||
|
subquery.select(couponRoot.get("goodsId"));
|
||||||
|
|
||||||
|
// 增加条件:goodsId is not null
|
||||||
|
subquery.where(criteriaBuilder.isNotNull(couponRoot.get("goodsId")));
|
||||||
|
|
||||||
|
// 添加not-in条件
|
||||||
|
predicateList.add(criteriaBuilder.not(root.get("id").in(subquery)));
|
||||||
|
|
||||||
|
return criteriaBuilder.and(predicateList.toArray(new Predicate[0]));
|
||||||
|
};
|
||||||
|
//处理数据:商品分类
|
||||||
|
List<SelfGoods> all = jpaRepository.findAll(queryCondition);
|
||||||
|
for (SelfGoods g : all) {
|
||||||
|
for (GoodsType goodsType : materialTypes) {
|
||||||
|
String typeId = g.getTypeId();
|
||||||
|
if (StringUtils.isNotEmpty(typeId) && typeId.equals(goodsType.getId().toString())) {
|
||||||
|
g.setType(goodsType);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HashMap<String, Object> map = Maps.newHashMap();
|
||||||
|
map.put("data", all);
|
||||||
|
return Result.success(map);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import com.sqx.modules.coupon.dao.CouponUserDao;
|
||||||
import com.sqx.modules.coupon.entity.Coupon;
|
import com.sqx.modules.coupon.entity.Coupon;
|
||||||
import com.sqx.modules.coupon.entity.CouponUser;
|
import com.sqx.modules.coupon.entity.CouponUser;
|
||||||
import com.sqx.modules.coupon.service.CouponUserService;
|
import com.sqx.modules.coupon.service.CouponUserService;
|
||||||
|
import com.sqx.modules.shopping.entity.SelfGoods;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
@ -60,6 +61,12 @@ public class CouponUserServiceImpl extends ServiceImpl<CouponUserDao, CouponUser
|
||||||
CouponUserDao.updateExpiration(date);
|
CouponUserDao.updateExpiration(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城优惠券
|
||||||
|
* @param userId
|
||||||
|
* @param couponId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public Result buyCoupon(Long userId, Long couponId) {
|
public Result buyCoupon(Long userId, Long couponId) {
|
||||||
|
@ -88,6 +95,44 @@ public class CouponUserServiceImpl extends ServiceImpl<CouponUserDao, CouponUser
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result buyShopCoupon(Long userId, Long goodsId) {
|
||||||
|
QueryWrapper<Coupon> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("goods_id",goodsId);
|
||||||
|
Coupon coupon = CouponDao.selectOne(queryWrapper);
|
||||||
|
//将优惠券添加到用户优惠券仓库
|
||||||
|
CouponUser couponUser = new CouponUser();
|
||||||
|
couponUser.setUserId(userId);
|
||||||
|
couponUser.setCouponName(coupon.getCouponName());
|
||||||
|
couponUser.setCouponPicture(coupon.getCouponPicture());
|
||||||
|
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||||
|
couponUser.setCreateTime(format);
|
||||||
|
//计算优惠券过期时间
|
||||||
|
Integer endDate = coupon.getEndDate();
|
||||||
|
if(endDate!=null){
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.add(Calendar.DATE, endDate);
|
||||||
|
calendar.add(Calendar.DATE, 1);
|
||||||
|
Date date = calendar.getTime();
|
||||||
|
String format1 = new SimpleDateFormat("yyyy-MM-dd").format(date);
|
||||||
|
couponUser.setExpirationTime(format1);
|
||||||
|
}else{
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.add(Calendar.DATE, 365);
|
||||||
|
calendar.add(Calendar.DATE, 1);
|
||||||
|
Date date = calendar.getTime();
|
||||||
|
String format1 = new SimpleDateFormat("yyyy-MM-dd").format(date);
|
||||||
|
couponUser.setExpirationTime(format1);
|
||||||
|
}
|
||||||
|
|
||||||
|
couponUser.setMinMoney(coupon.getMinMoney());
|
||||||
|
couponUser.setMoney(coupon.getMoney());
|
||||||
|
couponUser.setStatus(0);
|
||||||
|
CouponUserDao.insert(couponUser);
|
||||||
|
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result selectCouponByUserId(Integer page, Integer limit, String id, Long userId, Integer status, String phone,String couponName) {
|
public Result selectCouponByUserId(Integer page, Integer limit, String id, Long userId, Integer status, String phone,String couponName) {
|
||||||
String[] arr = null;
|
String[] arr = null;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import com.sqx.modules.artificer.dao.ArtificerDao;
|
||||||
import com.sqx.modules.artificer.dao.MassageTypeDao;
|
import com.sqx.modules.artificer.dao.MassageTypeDao;
|
||||||
import com.sqx.modules.artificer.entity.Artificer;
|
import com.sqx.modules.artificer.entity.Artificer;
|
||||||
import com.sqx.modules.artificer.entity.MassageType;
|
import com.sqx.modules.artificer.entity.MassageType;
|
||||||
|
import com.sqx.modules.coupon.service.impl.CouponUserServiceImpl;
|
||||||
import com.sqx.modules.material.dao.MaterialArtificerMapper;
|
import com.sqx.modules.material.dao.MaterialArtificerMapper;
|
||||||
import com.sqx.modules.material.dao.MaterialMapper;
|
import com.sqx.modules.material.dao.MaterialMapper;
|
||||||
import com.sqx.modules.material.dao.MaterialMassageMapper;
|
import com.sqx.modules.material.dao.MaterialMassageMapper;
|
||||||
|
@ -18,6 +19,8 @@ import com.sqx.modules.material.entity.MaterialMassage;
|
||||||
import com.sqx.modules.material.entity.MaterialRecord;
|
import com.sqx.modules.material.entity.MaterialRecord;
|
||||||
import com.sqx.modules.material.service.MaterialArtificerService;
|
import com.sqx.modules.material.service.MaterialArtificerService;
|
||||||
import com.sqx.modules.material.service.MaterialRecordService;
|
import com.sqx.modules.material.service.MaterialRecordService;
|
||||||
|
import com.sqx.modules.shopping.entity.SelfGoods;
|
||||||
|
import com.sqx.modules.shopping.service.impl.SelfGoodsServiceImpl;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -26,10 +29,10 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
* @description 针对表【material_artificer(物料包与技师中间表)】的数据库操作Service实现
|
* @description 针对表【material_artificer(物料包与技师中间表)】的数据库操作Service实现
|
||||||
* @createDate 2024-02-27 15:30:46
|
* @createDate 2024-02-27 15:30:46
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class MaterialArtificerServiceImpl extends ServiceImpl<MaterialArtificerMapper, MaterialArtificer> implements MaterialArtificerService {
|
public class MaterialArtificerServiceImpl extends ServiceImpl<MaterialArtificerMapper, MaterialArtificer> implements MaterialArtificerService {
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -42,6 +45,11 @@ public class MaterialArtificerServiceImpl extends ServiceImpl<MaterialArtificerM
|
||||||
private MassageTypeDao massageTypeDao;
|
private MassageTypeDao massageTypeDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ArtificerDao artificerDao;
|
private ArtificerDao artificerDao;
|
||||||
|
@Autowired
|
||||||
|
private SelfGoodsServiceImpl selfGoodsService;
|
||||||
|
@Autowired
|
||||||
|
private CouponUserServiceImpl couponUserService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result insertMaterialArtificer(MaterialArtificer materialArtificer) {
|
public Result insertMaterialArtificer(MaterialArtificer materialArtificer) {
|
||||||
materialArtificer.setCreateTime(new Date());
|
materialArtificer.setCreateTime(new Date());
|
||||||
|
@ -50,7 +58,7 @@ public class MaterialArtificerServiceImpl extends ServiceImpl<MaterialArtificerM
|
||||||
queryWrapper.eq("material_id", materialArtificer.getMaterialId());
|
queryWrapper.eq("material_id", materialArtificer.getMaterialId());
|
||||||
queryWrapper.eq("artificer_id", materialArtificer.getArtificerId());
|
queryWrapper.eq("artificer_id", materialArtificer.getArtificerId());
|
||||||
List<MaterialArtificer> materialArtificerList = baseMapper.selectList(queryWrapper);
|
List<MaterialArtificer> materialArtificerList = baseMapper.selectList(queryWrapper);
|
||||||
if(materialArtificerList.size()>0){
|
if (materialArtificerList.size() > 0) {
|
||||||
return Result.error("该物料包已被添加,请重新选择");
|
return Result.error("该物料包已被添加,请重新选择");
|
||||||
}
|
}
|
||||||
materialArtificer.setResidue(BigDecimal.ZERO);
|
materialArtificer.setResidue(BigDecimal.ZERO);
|
||||||
|
@ -61,14 +69,14 @@ public class MaterialArtificerServiceImpl extends ServiceImpl<MaterialArtificerM
|
||||||
@Override
|
@Override
|
||||||
public Result materialArtificerDelete(MaterialArtificer materialArtificer) {
|
public Result materialArtificerDelete(MaterialArtificer materialArtificer) {
|
||||||
MaterialArtificer materialArtificer1 = baseMapper.selectById(materialArtificer.getId());
|
MaterialArtificer materialArtificer1 = baseMapper.selectById(materialArtificer.getId());
|
||||||
if(materialArtificer1 == null){
|
if (materialArtificer1 == null) {
|
||||||
return Result.error("该技师物料包不存在,请重新选择");
|
return Result.error("该技师物料包不存在,请重新选择");
|
||||||
}
|
}
|
||||||
if(materialArtificer1.getResidue().compareTo(BigDecimal.ZERO) == 1){
|
if (materialArtificer1.getResidue().compareTo(BigDecimal.ZERO) == 1) {
|
||||||
return Result.error("该技师物料包未消耗空,请勿删除");
|
return Result.error("该技师物料包未消耗空,请勿删除");
|
||||||
}
|
}
|
||||||
int result = baseMapper.deleteById(materialArtificer.getId());
|
int result = baseMapper.deleteById(materialArtificer.getId());
|
||||||
return Result.success(result == 1 ?"删除成功":"删除失败");
|
return Result.success(result == 1 ? "删除成功" : "删除失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -76,13 +84,13 @@ public class MaterialArtificerServiceImpl extends ServiceImpl<MaterialArtificerM
|
||||||
MaterialArtificer materialArtificerData = baseMapper.selectById(materialArtificer.getId());
|
MaterialArtificer materialArtificerData = baseMapper.selectById(materialArtificer.getId());
|
||||||
materialArtificer.setUpdateTime(new Date());
|
materialArtificer.setUpdateTime(new Date());
|
||||||
//如果类型为1则执行添加剩余数量 否则执行减少剩余数量
|
//如果类型为1则执行添加剩余数量 否则执行减少剩余数量
|
||||||
if(materialArtificer.getType().equals(1)){
|
if (materialArtificer.getType().equals(1)) {
|
||||||
materialArtificer.setResidue(materialArtificerData.getResidue().add(materialArtificer.getBalance()));
|
materialArtificer.setResidue(materialArtificerData.getResidue().add(materialArtificer.getBalance()));
|
||||||
}else {
|
} else {
|
||||||
materialArtificer.setResidue(materialArtificerData.getResidue().subtract(materialArtificer.getBalance()));
|
materialArtificer.setResidue(materialArtificerData.getResidue().subtract(materialArtificer.getBalance()));
|
||||||
}
|
}
|
||||||
int result = baseMapper.updateById(materialArtificer);
|
int result = baseMapper.updateById(materialArtificer);
|
||||||
if(!materialArtificer.getBalance().equals(0)){
|
if (!materialArtificer.getBalance().equals(0)) {
|
||||||
//修改过剩余量,执行新增历史记录
|
//修改过剩余量,执行新增历史记录
|
||||||
MaterialRecord materialRecord = new MaterialRecord();
|
MaterialRecord materialRecord = new MaterialRecord();
|
||||||
materialRecord.setMaterialId(materialArtificerData.getMaterialId());
|
materialRecord.setMaterialId(materialArtificerData.getMaterialId());
|
||||||
|
@ -94,31 +102,31 @@ public class MaterialArtificerServiceImpl extends ServiceImpl<MaterialArtificerM
|
||||||
materialRecord.setCreateUser(materialArtificer.getUpdateUser());
|
materialRecord.setCreateUser(materialArtificer.getUpdateUser());
|
||||||
materialRecord.setArtificerId(materialArtificerData.getArtificerId());
|
materialRecord.setArtificerId(materialArtificerData.getArtificerId());
|
||||||
materialRecord.setUpdateUser(materialArtificer.getUpdateUser());
|
materialRecord.setUpdateUser(materialArtificer.getUpdateUser());
|
||||||
materialRecord.setRecordDescribe(DateUtil.date()+"管理员:"+materialArtificer.getUpdateUser()+(materialArtificer.getType().equals(1)?"新增数量:":"减少数量:")+materialArtificer.getBalance());
|
materialRecord.setRecordDescribe(DateUtil.date() + "管理员:" + materialArtificer.getUpdateUser() + (materialArtificer.getType().equals(1) ? "新增数量:" : "减少数量:") + materialArtificer.getBalance());
|
||||||
materialRecordService.addMaterialRecord(materialRecord);
|
materialRecordService.addMaterialRecord(materialRecord);
|
||||||
}
|
}
|
||||||
return Result.success(result == 1 ?"修改成功":"修改失败");
|
return Result.success(result == 1 ? "修改成功" : "修改失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String accomplishOrders(Long messageTypeId, Long artificerId,String orderNo) {
|
public String accomplishOrders(Long messageTypeId, Long artificerId, String orderNo) {
|
||||||
QueryWrapper<MaterialMassage> materialMassageQueryWrapper = new QueryWrapper();
|
QueryWrapper<MaterialMassage> materialMassageQueryWrapper = new QueryWrapper();
|
||||||
QueryWrapper<MaterialArtificer> materialArtificerQueryWrapper = new QueryWrapper();
|
QueryWrapper<MaterialArtificer> materialArtificerQueryWrapper = new QueryWrapper();
|
||||||
QueryWrapper<MassageType> massageTypeQueryWrapper = new QueryWrapper();
|
QueryWrapper<MassageType> massageTypeQueryWrapper = new QueryWrapper();
|
||||||
//查询所有含有messageTypeId或者parent_id的数据
|
//查询所有含有messageTypeId或者parent_id的数据
|
||||||
massageTypeQueryWrapper.eq("massage_type_id",messageTypeId).or().eq("parent_id",messageTypeId);
|
massageTypeQueryWrapper.eq("massage_type_id", messageTypeId).or().eq("parent_id", messageTypeId);
|
||||||
List<MassageType> massageTypeList = massageTypeDao.selectList(massageTypeQueryWrapper);
|
List<MassageType> massageTypeList = massageTypeDao.selectList(massageTypeQueryWrapper);
|
||||||
//查询id为messageTypeId或者parent_id为messageTypeId
|
//查询id为messageTypeId或者parent_id为messageTypeId
|
||||||
materialMassageQueryWrapper.in("massage_type_id",massageTypeList.stream().map(MassageType::getMassageTypeId).toArray());
|
materialMassageQueryWrapper.in("massage_type_id", massageTypeList.stream().map(MassageType::getMassageTypeId).toArray());
|
||||||
List<MaterialMassage> materialMassageList = materialMassageMapper.selectList(materialMassageQueryWrapper);
|
List<MaterialMassage> materialMassageList = materialMassageMapper.selectList(materialMassageQueryWrapper);
|
||||||
materialMassageQueryWrapper.eq("artificer_id",artificerId);
|
materialMassageQueryWrapper.eq("artificer_id", artificerId);
|
||||||
List<MaterialArtificer> materialArtificers = baseMapper.selectList(materialArtificerQueryWrapper);
|
List<MaterialArtificer> materialArtificers = baseMapper.selectList(materialArtificerQueryWrapper);
|
||||||
//循环列表消耗物料包
|
//循环列表消耗物料包
|
||||||
for (int i = 0; i < materialMassageList.size(); i++){
|
for (int i = 0; i < materialMassageList.size(); i++) {
|
||||||
for (int j = 0; j < materialArtificers.size(); j++){
|
for (int j = 0; j < materialArtificers.size(); j++) {
|
||||||
if(materialMassageList.get(i).getMaterialId().equals(materialArtificers.get(j).getMaterialId())){
|
if (materialMassageList.get(i).getMaterialId().equals(materialArtificers.get(j).getMaterialId())) {
|
||||||
BigDecimal reside = BigDecimal.ZERO;
|
BigDecimal reside = BigDecimal.ZERO;
|
||||||
if(materialArtificers.get(j).getResidue()!=null){
|
if (materialArtificers.get(j).getResidue() != null) {
|
||||||
reside = materialArtificers.get(j).getResidue();
|
reside = materialArtificers.get(j).getResidue();
|
||||||
}
|
}
|
||||||
materialArtificers.get(j).setResidue(reside.subtract(materialMassageList.get(i).getConsume()));
|
materialArtificers.get(j).setResidue(reside.subtract(materialMassageList.get(i).getConsume()));
|
||||||
|
@ -134,7 +142,7 @@ public class MaterialArtificerServiceImpl extends ServiceImpl<MaterialArtificerM
|
||||||
materialRecord.setCreateUser(Long.valueOf(materialArtificers.get(i).getArtificerId()));
|
materialRecord.setCreateUser(Long.valueOf(materialArtificers.get(i).getArtificerId()));
|
||||||
materialRecord.setArtificerId(materialArtificers.get(i).getArtificerId());
|
materialRecord.setArtificerId(materialArtificers.get(i).getArtificerId());
|
||||||
materialRecord.setUpdateUser(Long.valueOf(materialArtificers.get(i).getArtificerId()));
|
materialRecord.setUpdateUser(Long.valueOf(materialArtificers.get(i).getArtificerId()));
|
||||||
materialRecord.setRecordDescribe(DateUtil.date()+" 订单编号:"+orderNo +"; "+(materialRecord.getType().equals(1)?"新增数量:":"减少数量:")+materialMassageList.get(i).getConsume());
|
materialRecord.setRecordDescribe(DateUtil.date() + " 订单编号:" + orderNo + "; " + (materialRecord.getType().equals(1) ? "新增数量:" : "减少数量:") + materialMassageList.get(i).getConsume());
|
||||||
materialRecordService.addMaterialRecord(materialRecord);
|
materialRecordService.addMaterialRecord(materialRecord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,16 +152,21 @@ public class MaterialArtificerServiceImpl extends ServiceImpl<MaterialArtificerM
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changePay(Long id, Long userId, Integer number) {
|
public void changePay(Long id, Long userId, Integer number) {
|
||||||
|
SelfGoods selfGoods = (SelfGoods)selfGoodsService.findOne(id).getData();
|
||||||
|
//如果是代金券
|
||||||
|
if("57".equals(selfGoods.getTypeId())){
|
||||||
|
couponUserService.buyShopCoupon(userId, id);
|
||||||
|
}else{//其它
|
||||||
//查询技师id
|
//查询技师id
|
||||||
Artificer artificer = artificerDao.selectOne(new QueryWrapper<Artificer>().eq("user_id",userId));
|
Artificer artificer = artificerDao.selectOne(new QueryWrapper<Artificer>().eq("user_id", userId));
|
||||||
//查询物料包id
|
//查询物料包id
|
||||||
Material material = materialMapper.selectOne(new QueryWrapper<Material>().eq("goods_id",id));
|
Material material = materialMapper.selectOne(new QueryWrapper<Material>().eq("goods_id", id));
|
||||||
if(ObjectUtil.isEmpty(material)){
|
if (ObjectUtil.isEmpty(material)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//根据物料包id和技师id查询技师对应物料包
|
//根据物料包id和技师id查询技师对应物料包
|
||||||
MaterialArtificer materialArtificer = baseMapper.selectOne(new QueryWrapper<MaterialArtificer>().eq("artificer_id",artificer.getArtificerId()).eq("material_id",material.getId()));
|
MaterialArtificer materialArtificer = baseMapper.selectOne(new QueryWrapper<MaterialArtificer>().eq("artificer_id", artificer.getArtificerId()).eq("material_id", material.getId()));
|
||||||
if(materialArtificer != null && materialArtificer.getResidue() !=null){
|
if (materialArtificer != null && materialArtificer.getResidue() != null) {
|
||||||
//修改物料包数量
|
//修改物料包数量
|
||||||
materialArtificer.setResidue(materialArtificer.getResidue().add(new BigDecimal(number)));
|
materialArtificer.setResidue(materialArtificer.getResidue().add(new BigDecimal(number)));
|
||||||
baseMapper.updateById(materialArtificer);
|
baseMapper.updateById(materialArtificer);
|
||||||
|
@ -168,10 +181,10 @@ public class MaterialArtificerServiceImpl extends ServiceImpl<MaterialArtificerM
|
||||||
materialRecord.setCreateUser(Long.valueOf(materialArtificer.getArtificerId()));
|
materialRecord.setCreateUser(Long.valueOf(materialArtificer.getArtificerId()));
|
||||||
materialRecord.setArtificerId(materialArtificer.getArtificerId());
|
materialRecord.setArtificerId(materialArtificer.getArtificerId());
|
||||||
materialRecord.setUpdateUser(Long.valueOf(materialArtificer.getArtificerId()));
|
materialRecord.setUpdateUser(Long.valueOf(materialArtificer.getArtificerId()));
|
||||||
materialRecord.setRecordDescribe(DateUtil.date()+"通过商城购买"+(materialRecord.getType().equals(1)?"新增数量:":"减少数量:")+materialArtificer.getResidue());
|
materialRecord.setRecordDescribe(DateUtil.date() + "通过商城购买" + (materialRecord.getType().equals(1) ? "新增数量:" : "减少数量:") + materialArtificer.getResidue());
|
||||||
materialRecordService.addMaterialRecord(materialRecord);
|
materialRecordService.addMaterialRecord(materialRecord);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import com.sqx.modules.message.entity.MessageInfo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,4 +31,5 @@ public interface MessageInfoDao extends BaseMapper<MessageInfo> {
|
||||||
IPage<Map<String,Object>> selectArtificerList(Page<Map<String,Object>> page,String artificerName,String phone);
|
IPage<Map<String,Object>> selectArtificerList(Page<Map<String,Object>> page,String artificerName,String phone);
|
||||||
|
|
||||||
|
|
||||||
|
List<MessageInfo> queryComplaints();
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,4 +113,7 @@ public class MessageInfo implements Serializable {
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String obj;
|
private String obj;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private int cs;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import com.sqx.modules.message.entity.MessageInfo;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.web.bind.annotation.RequestAttribute;
|
import org.springframework.web.bind.annotation.RequestAttribute;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public interface MessageService extends IService<MessageInfo> {
|
public interface MessageService extends IService<MessageInfo> {
|
||||||
|
@ -46,4 +47,5 @@ public interface MessageService extends IService<MessageInfo> {
|
||||||
|
|
||||||
void sendNoticeByCall(Long userId);
|
void sendNoticeByCall(Long userId);
|
||||||
|
|
||||||
|
List<MessageInfo> queryComplaints();
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,4 +281,9 @@ public class MessageServiceImpl extends
|
||||||
AppNotifyUtil.AppNotify(byId.getPhone(),accountId,token,templateId);
|
AppNotifyUtil.AppNotify(byId.getPhone(),accountId,token,templateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MessageInfo> queryComplaints() {
|
||||||
|
return baseMapper.queryComplaints();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,16 @@ import com.sqx.modules.bl.commission.jjr.entity.JjrConfigLevel;
|
||||||
import com.sqx.modules.bl.commission.jjr.service.JjrApplyService;
|
import com.sqx.modules.bl.commission.jjr.service.JjrApplyService;
|
||||||
import com.sqx.modules.bl.commission.jjr.service.JjrConfigLevelService;
|
import com.sqx.modules.bl.commission.jjr.service.JjrConfigLevelService;
|
||||||
import com.sqx.modules.bl.commission.jjr.service.JjrConfigService;
|
import com.sqx.modules.bl.commission.jjr.service.JjrConfigService;
|
||||||
|
import com.sqx.modules.bl.commission.qds.entity.QdsApply;
|
||||||
|
import com.sqx.modules.bl.commission.qds.entity.QdsCode;
|
||||||
|
import com.sqx.modules.bl.commission.qds.entity.QdsConfig;
|
||||||
|
import com.sqx.modules.bl.commission.qds.service.QdsConfigService;
|
||||||
|
import com.sqx.modules.bl.commission.qds.service.impl.DqsApplyServiceImpl;
|
||||||
|
import com.sqx.modules.bl.commission.qds.service.impl.DqsCodeServiceImpl;
|
||||||
|
import com.sqx.modules.bl.commission.ywy.entity.YwyApply;
|
||||||
|
import com.sqx.modules.bl.commission.ywy.entity.YwyConfig;
|
||||||
|
import com.sqx.modules.bl.commission.ywy.service.impl.YwyApplyServiceImpl;
|
||||||
|
import com.sqx.modules.bl.commission.ywy.service.impl.YwyConfigServiceImpl;
|
||||||
import com.sqx.modules.bl.massage.entity.MassagePackage;
|
import com.sqx.modules.bl.massage.entity.MassagePackage;
|
||||||
import com.sqx.modules.bl.massage.service.MassagePackageService;
|
import com.sqx.modules.bl.massage.service.MassagePackageService;
|
||||||
import com.sqx.modules.bl.order.dao.UserPackageOrderDao;
|
import com.sqx.modules.bl.order.dao.UserPackageOrderDao;
|
||||||
|
@ -92,6 +102,8 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -181,6 +193,16 @@ public class AliPayController {
|
||||||
private ArtificerIntegralStatisticsService artificerIntegralStatisticsService;
|
private ArtificerIntegralStatisticsService artificerIntegralStatisticsService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysDictService sysDictService;
|
private SysDictService sysDictService;
|
||||||
|
@Autowired
|
||||||
|
private DqsCodeServiceImpl dqsCodeService;
|
||||||
|
@Autowired
|
||||||
|
private DqsApplyServiceImpl dqsApplyService;
|
||||||
|
@Autowired
|
||||||
|
private QdsConfigService qdsConfigService;
|
||||||
|
@Autowired
|
||||||
|
private YwyApplyServiceImpl ywyApplyService;
|
||||||
|
@Autowired
|
||||||
|
private YwyConfigServiceImpl ywyConfigService;
|
||||||
|
|
||||||
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
@ -735,8 +757,9 @@ public class AliPayController {
|
||||||
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
||||||
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
||||||
FxyConfig fc = fxyConfigService.getOne(new QueryWrapper<FxyConfig>());
|
FxyConfig fc = fxyConfigService.getOne(new QueryWrapper<FxyConfig>());
|
||||||
|
UserEntity user = null;
|
||||||
if(fc!=null && fc.getIsOpen().equals(1)){
|
if(fc!=null && fc.getIsOpen().equals(1)){
|
||||||
UserEntity user = userService.selectUserById(orders.getUserId());
|
user = userService.selectUserById(orders.getUserId());
|
||||||
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
||||||
if(fxyOneUser!=null){
|
if(fxyOneUser!=null){
|
||||||
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
||||||
|
@ -842,12 +865,105 @@ public class AliPayController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//渠道商与业务员
|
||||||
|
//逻辑:先计算渠道商分佣 = 支付费用 * 渠道分成
|
||||||
|
// 这个钱从技师和平台身上出 技师有承担比例 剩余的就是平台出的钱
|
||||||
|
// 再计算业务员分佣 = 支付费用 * 业务员返佣比例 如果业务员配置了和渠道商是抽成关系 需要再 减去 渠道商分佣
|
||||||
|
// 然后这个分佣从技师和平台身上出 技师有承担比例 剩余的就是平台出的钱
|
||||||
|
orders.setQdsCodeMoney(BigDecimal.ZERO);//渠道商应拿分佣
|
||||||
|
orders.setQdsArtificerDeductMoney(BigDecimal.ZERO);//渠道商分佣技师承担金额
|
||||||
|
orders.setYwyCodeMoney(BigDecimal.ZERO);//业务员应拿分佣
|
||||||
|
orders.setYwyArtificerDeductMoney(BigDecimal.ZERO);//业务员分佣技师承担金额
|
||||||
|
{
|
||||||
|
//只需要看orders表里qds_code是否有值,有值则为本单对应渠道商
|
||||||
|
String qdsCode = orders.getQdsCode();//渠道商邀请码 如果即是渠道商邀请的新用户 又是老客户扫渠道码下单 则取后者
|
||||||
|
BigDecimal qdsbl = new BigDecimal(0);//渠道商分佣比例
|
||||||
|
BigDecimal qdsjsfdbl = new BigDecimal(0);//渠道商分佣技师承担比例
|
||||||
|
if (StringUtils.isNotBlank(qdsCode)) {
|
||||||
|
//判断渠道码是否在有效期内、渠道商是否有授权、渠道商功能是否开启,渠道码有效才计算渠道商和业务员分佣
|
||||||
|
//判断渠道码是否在有效期内
|
||||||
|
QdsCode qdsCodeInfo = dqsCodeService.queryQdmInfo(qdsCode);
|
||||||
|
if(qdsCodeInfo != null){
|
||||||
|
qdsbl = qdsCodeInfo.getRate();
|
||||||
|
LocalDate currentDate = LocalDate.now();
|
||||||
|
boolean isValid = true;//渠道商是否进行分佣
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
if (qdsCodeInfo.getStartDate() != null && !qdsCodeInfo.getStartDate().isEmpty()) {
|
||||||
|
LocalDate start = LocalDate.parse(qdsCodeInfo.getStartDate(), formatter);
|
||||||
|
if (currentDate.isBefore(start)) {
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isValid && qdsCodeInfo.getEndDate() != null && !qdsCodeInfo.getEndDate().isEmpty()) {
|
||||||
|
LocalDate end = LocalDate.parse(qdsCodeInfo.getEndDate(), formatter);
|
||||||
|
if (currentDate.isAfter(end)) {
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(isValid){
|
||||||
|
//判断渠道商是否有授权(需要查两个表的渠道商状态)
|
||||||
|
QdsApply qdsApplyInfo = dqsApplyService.findByUserId(qdsCodeInfo.getUserId());
|
||||||
|
if(qdsApplyInfo != null && qdsApplyInfo.getStatus() == 1){
|
||||||
|
UserEntity qdsInfo = userService.selectUserById(qdsCodeInfo.getUserId());
|
||||||
|
if(qdsInfo != null && qdsInfo.getBlIsQds() == 1){
|
||||||
|
//判断渠道商功能是否开启
|
||||||
|
QdsConfig qdsConfig = qdsConfigService.getOne(null);
|
||||||
|
if(qdsConfig!=null && qdsConfig.getIsOpen() == 1){
|
||||||
|
orders.setQdsUserId(qdsInfo.getUserId());
|
||||||
|
orders.setQdsUserName(qdsInfo.getUserName());
|
||||||
|
qdsjsfdbl = qdsConfig.getArtificerRate();
|
||||||
|
//开始计算渠道商分佣
|
||||||
|
BigDecimal qdsMoney = subtract.multiply(qdsbl).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setQdsCodeMoney(qdsMoney);
|
||||||
|
BigDecimal qdsArtificerDeductMoney = qdsMoney.multiply(qdsjsfdbl).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setQdsArtificerDeductMoney(qdsArtificerDeductMoney);
|
||||||
|
|
||||||
|
//计算业务员分佣
|
||||||
|
{
|
||||||
|
//先用渠道商的业务员邀请码获取到业务员信息,判断tb_user表里是否业务员字段是否 = 1 然后看看后台业务员是否授权 再有一个看看业务员配置 功能是否已开启
|
||||||
|
UserEntity ywyUser = userService.queryByInvitationCode(qdsInfo.getBlYwyCode());
|
||||||
|
if(ywyUser != null && ywyUser.getBlIsYwy() == 1){
|
||||||
|
YwyApply ywyApply = ywyApplyService.selectByUserId(ywyUser.getUserId());
|
||||||
|
if(ywyApply != null && ywyApply.getStatus() == 1){
|
||||||
|
YwyConfig ywyConfig = ywyConfigService.getOne(null);
|
||||||
|
if(ywyConfig!= null && ywyConfig.getIsOpen() == 1){
|
||||||
|
orders.setYwyUserId(ywyUser.getUserId());
|
||||||
|
orders.setYwyUserName(ywyUser.getUserName());
|
||||||
|
//正式开始计算业务员分佣
|
||||||
|
//开始计算渠道商分佣
|
||||||
|
BigDecimal ywyMoney = subtract.multiply(ywyApply.getRate()).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
if(ywyConfig.getType() == 2){
|
||||||
|
//业务员分佣金额大于渠道商分佣金额
|
||||||
|
if(ywyMoney.compareTo(qdsMoney) == 1){
|
||||||
|
ywyMoney = ywyMoney.subtract(qdsMoney);
|
||||||
|
}else{
|
||||||
|
//业务员分佣金额小于等于渠道商分佣金额
|
||||||
|
ywyMoney = new BigDecimal(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
orders.setYwyCodeMoney(ywyMoney);
|
||||||
|
BigDecimal ywyArtificerDeductMoney = ywyMoney.multiply(ywyConfig.getArtificerRate()).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setYwyArtificerDeductMoney(ywyArtificerDeductMoney);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
|
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
|
||||||
artificerPrice = artificerPrice.subtract(orders.getJjrArtificerDeductMoney());
|
artificerPrice = artificerPrice.subtract(orders.getJjrArtificerDeductMoney());
|
||||||
artificerPrice = artificerPrice.subtract(shopMoney);
|
artificerPrice = artificerPrice.subtract(shopMoney);
|
||||||
// artificerPrice = artificerPrice.subtract(oneUserMoney);
|
// artificerPrice = artificerPrice.subtract(oneUserMoney);
|
||||||
artificerPrice = artificerPrice.subtract(orders.getFxyOneArtificerDeductMoney());//减掉一级分销商分佣技师承担
|
artificerPrice = artificerPrice.subtract(orders.getFxyOneArtificerDeductMoney());//减掉一级分销商分佣技师承担
|
||||||
artificerPrice = artificerPrice.subtract(orders.getFxyTwoArtificerDeductMoney());//减掉二级分销商分佣技师承担
|
artificerPrice = artificerPrice.subtract(orders.getFxyTwoArtificerDeductMoney());//减掉二级分销商分佣技师承担
|
||||||
|
artificerPrice = artificerPrice.subtract(orders.getQdsArtificerDeductMoney());//减去渠道商分佣 技师承担金额
|
||||||
|
artificerPrice = artificerPrice.subtract(orders.getYwyArtificerDeductMoney());//减去业务员分佣 技师承担金额
|
||||||
if(orders.getIsSupplement()!=null && orders.getIsSupplement().equals(2)){
|
if(orders.getIsSupplement()!=null && orders.getIsSupplement().equals(2)){
|
||||||
}else{
|
}else{
|
||||||
//用户收益加上通行费用
|
//用户收益加上通行费用
|
||||||
|
@ -865,6 +981,8 @@ public class AliPayController {
|
||||||
// pingMoney = pingMoney.subtract(oneUserMoney);
|
// pingMoney = pingMoney.subtract(oneUserMoney);
|
||||||
pingMoney = pingMoney.subtract(orders.getFxyOneMoney());//减掉一级分销商分佣
|
pingMoney = pingMoney.subtract(orders.getFxyOneMoney());//减掉一级分销商分佣
|
||||||
pingMoney = pingMoney.subtract(orders.getFxyTwoMoney());//减掉二级分销商分佣
|
pingMoney = pingMoney.subtract(orders.getFxyTwoMoney());//减掉二级分销商分佣
|
||||||
|
pingMoney = pingMoney.subtract(orders.getQdsCodeMoney());//减掉渠道商分佣
|
||||||
|
pingMoney = pingMoney.subtract(orders.getYwyCodeMoney());//减掉业务员分佣
|
||||||
orders.setPingMoney(pingMoney);
|
orders.setPingMoney(pingMoney);
|
||||||
|
|
||||||
ordersService.updateById(orders);
|
ordersService.updateById(orders);
|
||||||
|
@ -946,6 +1064,8 @@ public class AliPayController {
|
||||||
orders1.setAddJjrArtificerDeductMoney(orders1.getAddJjrArtificerDeductMoney().add(orders.getJjrArtificerDeductMoney()));
|
orders1.setAddJjrArtificerDeductMoney(orders1.getAddJjrArtificerDeductMoney().add(orders.getJjrArtificerDeductMoney()));
|
||||||
orders1.setAddFxyOneArtificerDeductMoney(orders1.getAddFxyOneArtificerDeductMoney().add(orders.getFxyOneArtificerDeductMoney()));
|
orders1.setAddFxyOneArtificerDeductMoney(orders1.getAddFxyOneArtificerDeductMoney().add(orders.getFxyOneArtificerDeductMoney()));
|
||||||
orders1.setAddFxyTwoArtificerDeductMoney(orders1.getAddFxyTwoArtificerDeductMoney().add(orders.getFxyTwoArtificerDeductMoney()));
|
orders1.setAddFxyTwoArtificerDeductMoney(orders1.getAddFxyTwoArtificerDeductMoney().add(orders.getFxyTwoArtificerDeductMoney()));
|
||||||
|
orders1.setAddQdsArtificerDeductMoney(orders1.getAddQdsArtificerDeductMoney().add(orders.getQdsArtificerDeductMoney()));
|
||||||
|
orders1.setAddYwyArtificerDeductMoney(orders1.getAddYwyArtificerDeductMoney().add(orders.getYwyArtificerDeductMoney()));
|
||||||
}else{
|
}else{
|
||||||
orders1.setAddMoney(orders.getPayMoney());
|
orders1.setAddMoney(orders.getPayMoney());
|
||||||
orders1.setAddArtificerMoney(orders.getArtificerMoney());
|
orders1.setAddArtificerMoney(orders.getArtificerMoney());
|
||||||
|
@ -957,6 +1077,8 @@ public class AliPayController {
|
||||||
orders1.setAddJjrArtificerDeductMoney(orders.getJjrArtificerDeductMoney());
|
orders1.setAddJjrArtificerDeductMoney(orders.getJjrArtificerDeductMoney());
|
||||||
orders1.setAddFxyOneArtificerDeductMoney(orders.getFxyOneArtificerDeductMoney());
|
orders1.setAddFxyOneArtificerDeductMoney(orders.getFxyOneArtificerDeductMoney());
|
||||||
orders1.setAddFxyTwoArtificerDeductMoney(orders.getFxyTwoArtificerDeductMoney());
|
orders1.setAddFxyTwoArtificerDeductMoney(orders.getFxyTwoArtificerDeductMoney());
|
||||||
|
orders1.setAddQdsArtificerDeductMoney(orders.getQdsArtificerDeductMoney());
|
||||||
|
orders1.setAddYwyArtificerDeductMoney(orders.getYwyArtificerDeductMoney());
|
||||||
}
|
}
|
||||||
orders1.setSumMoney(orders1.getSumMoney().add(orders.getPayMoney()));
|
orders1.setSumMoney(orders1.getSumMoney().add(orders.getPayMoney()));
|
||||||
orders1.setSumArtificerMoney(orders1.getSumArtificerMoney().add(orders.getArtificerMoney()));
|
orders1.setSumArtificerMoney(orders1.getSumArtificerMoney().add(orders.getArtificerMoney()));
|
||||||
|
@ -969,6 +1091,8 @@ public class AliPayController {
|
||||||
// orders1.setFxyTwoMoney(orders1.getFxyTwoMoney().add(orders.getFxyTwoMoney()));
|
// orders1.setFxyTwoMoney(orders1.getFxyTwoMoney().add(orders.getFxyTwoMoney()));
|
||||||
// orders1.setFxyOneArtificerDeductMoney(orders1.getFxyOneArtificerDeductMoney().add(orders.getFxyOneArtificerDeductMoney()));
|
// orders1.setFxyOneArtificerDeductMoney(orders1.getFxyOneArtificerDeductMoney().add(orders.getFxyOneArtificerDeductMoney()));
|
||||||
// orders1.setFxyTwoArtificerDeductMoney(orders1.getFxyTwoArtificerDeductMoney().add(orders.getFxyTwoArtificerDeductMoney()));
|
// orders1.setFxyTwoArtificerDeductMoney(orders1.getFxyTwoArtificerDeductMoney().add(orders.getFxyTwoArtificerDeductMoney()));
|
||||||
|
// orders1.setQdsCodeMoney(orders1.getQdsCodeMoney().add(orders.getQdsCodeMoney()));
|
||||||
|
// orders1.setYwyCodeMoney(orders1.getYwyCodeMoney().add(orders.getYwyCodeMoney()));
|
||||||
// orders1.setPingMoney(orders1.getPingMoney().add(orders.getPingMoney()));
|
// orders1.setPingMoney(orders1.getPingMoney().add(orders.getPingMoney()));
|
||||||
|
|
||||||
if(orders1.getStatus().equals(6)){
|
if(orders1.getStatus().equals(6)){
|
||||||
|
|
|
@ -32,6 +32,16 @@ import com.sqx.modules.bl.commission.jjr.entity.JjrConfigLevel;
|
||||||
import com.sqx.modules.bl.commission.jjr.service.JjrApplyService;
|
import com.sqx.modules.bl.commission.jjr.service.JjrApplyService;
|
||||||
import com.sqx.modules.bl.commission.jjr.service.JjrConfigLevelService;
|
import com.sqx.modules.bl.commission.jjr.service.JjrConfigLevelService;
|
||||||
import com.sqx.modules.bl.commission.jjr.service.JjrConfigService;
|
import com.sqx.modules.bl.commission.jjr.service.JjrConfigService;
|
||||||
|
import com.sqx.modules.bl.commission.qds.entity.QdsApply;
|
||||||
|
import com.sqx.modules.bl.commission.qds.entity.QdsCode;
|
||||||
|
import com.sqx.modules.bl.commission.qds.entity.QdsConfig;
|
||||||
|
import com.sqx.modules.bl.commission.qds.service.QdsConfigService;
|
||||||
|
import com.sqx.modules.bl.commission.qds.service.impl.DqsApplyServiceImpl;
|
||||||
|
import com.sqx.modules.bl.commission.qds.service.impl.DqsCodeServiceImpl;
|
||||||
|
import com.sqx.modules.bl.commission.ywy.entity.YwyApply;
|
||||||
|
import com.sqx.modules.bl.commission.ywy.entity.YwyConfig;
|
||||||
|
import com.sqx.modules.bl.commission.ywy.service.impl.YwyApplyServiceImpl;
|
||||||
|
import com.sqx.modules.bl.commission.ywy.service.impl.YwyConfigServiceImpl;
|
||||||
import com.sqx.modules.bl.massage.entity.MassagePackage;
|
import com.sqx.modules.bl.massage.entity.MassagePackage;
|
||||||
import com.sqx.modules.bl.massage.service.MassagePackageService;
|
import com.sqx.modules.bl.massage.service.MassagePackageService;
|
||||||
import com.sqx.modules.bl.order.dao.UserPackageOrderDao;
|
import com.sqx.modules.bl.order.dao.UserPackageOrderDao;
|
||||||
|
@ -77,7 +87,9 @@ import org.springframework.stereotype.Service;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -173,6 +185,16 @@ public class WxServiceImpl implements WxService {
|
||||||
private ArtificerIntegralStatisticsService artificerIntegralStatisticsService;
|
private ArtificerIntegralStatisticsService artificerIntegralStatisticsService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysDictService sysDictService;
|
private SysDictService sysDictService;
|
||||||
|
@Autowired
|
||||||
|
private DqsCodeServiceImpl dqsCodeService;
|
||||||
|
@Autowired
|
||||||
|
private DqsApplyServiceImpl dqsApplyService;
|
||||||
|
@Autowired
|
||||||
|
private QdsConfigService qdsConfigService;
|
||||||
|
@Autowired
|
||||||
|
private YwyApplyServiceImpl ywyApplyService;
|
||||||
|
@Autowired
|
||||||
|
private YwyConfigServiceImpl ywyConfigService;
|
||||||
|
|
||||||
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
@ -2823,8 +2845,9 @@ public class WxServiceImpl implements WxService {
|
||||||
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
orders.setFxyTwoMoney(BigDecimal.ZERO);
|
||||||
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
orders.setFxyTwoArtificerDeductMoney(BigDecimal.ZERO);
|
||||||
FxyConfig fc = fxyConfigService.getOne(new QueryWrapper<FxyConfig>());
|
FxyConfig fc = fxyConfigService.getOne(new QueryWrapper<FxyConfig>());
|
||||||
|
UserEntity user = null;
|
||||||
if(fc!=null && fc.getIsOpen().equals(1)){
|
if(fc!=null && fc.getIsOpen().equals(1)){
|
||||||
UserEntity user = userService.selectUserById(orders.getUserId());
|
user = userService.selectUserById(orders.getUserId());
|
||||||
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
UserEntity fxyOneUser = userService.queryByInvitationCode(user.getBlFxyCode());
|
||||||
if(fxyOneUser!=null){
|
if(fxyOneUser!=null){
|
||||||
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
FxyApply faOne = fxyApplyService.findByUserId(fxyOneUser.getUserId());
|
||||||
|
@ -2930,12 +2953,106 @@ public class WxServiceImpl implements WxService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//渠道商与业务员
|
||||||
|
//逻辑:先计算渠道商分佣 = 支付费用 * 渠道分成
|
||||||
|
// 这个钱从技师和平台身上出 技师有承担比例 剩余的就是平台出的钱
|
||||||
|
// 再计算业务员分佣 = 支付费用 * 业务员返佣比例 如果业务员配置了和渠道商是抽成关系 需要再 减去 渠道商分佣
|
||||||
|
// 然后这个分佣从技师和平台身上出 技师有承担比例 剩余的就是平台出的钱
|
||||||
|
orders.setQdsCodeMoney(BigDecimal.ZERO);//渠道商应拿分佣
|
||||||
|
orders.setQdsArtificerDeductMoney(BigDecimal.ZERO);//渠道商分佣技师承担金额
|
||||||
|
orders.setYwyCodeMoney(BigDecimal.ZERO);//业务员应拿分佣
|
||||||
|
orders.setYwyArtificerDeductMoney(BigDecimal.ZERO);//业务员分佣技师承担金额
|
||||||
|
{
|
||||||
|
//只需要看orders表里qds_code是否有值,有值则为本单对应渠道商
|
||||||
|
String qdsCode = orders.getQdsCode();//渠道商邀请码 如果即是渠道商邀请的新用户 又是老客户扫渠道码下单 则取后者
|
||||||
|
BigDecimal qdsbl = new BigDecimal(0);//渠道商分佣比例
|
||||||
|
BigDecimal qdsjsfdbl = new BigDecimal(0);//渠道商分佣技师承担比例
|
||||||
|
if (StringUtils.isNotBlank(qdsCode)) {
|
||||||
|
//判断渠道码是否在有效期内、渠道商是否有授权、渠道商功能是否开启,渠道码有效才计算渠道商和业务员分佣
|
||||||
|
//判断渠道码是否在有效期内
|
||||||
|
QdsCode qdsCodeInfo = dqsCodeService.queryQdmInfo(qdsCode);
|
||||||
|
if(qdsCodeInfo != null){
|
||||||
|
qdsbl = qdsCodeInfo.getRate();
|
||||||
|
LocalDate currentDate = LocalDate.now();
|
||||||
|
boolean isValid = true;//渠道商是否进行分佣
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
if (qdsCodeInfo.getStartDate() != null && !qdsCodeInfo.getStartDate().isEmpty()) {
|
||||||
|
LocalDate start = LocalDate.parse(qdsCodeInfo.getStartDate(), formatter);
|
||||||
|
if (currentDate.isBefore(start)) {
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isValid && qdsCodeInfo.getEndDate() != null && !qdsCodeInfo.getEndDate().isEmpty()) {
|
||||||
|
LocalDate end = LocalDate.parse(qdsCodeInfo.getEndDate(), formatter);
|
||||||
|
if (currentDate.isAfter(end)) {
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(isValid){
|
||||||
|
//判断渠道商是否有授权(需要查两个表的渠道商状态)
|
||||||
|
QdsApply qdsApplyInfo = dqsApplyService.findByUserId(qdsCodeInfo.getUserId());
|
||||||
|
if(qdsApplyInfo != null && qdsApplyInfo.getStatus() == 1){
|
||||||
|
UserEntity qdsInfo = userService.selectUserById(qdsCodeInfo.getUserId());
|
||||||
|
if(qdsInfo != null && qdsInfo.getBlIsQds() == 1){
|
||||||
|
//判断渠道商功能是否开启
|
||||||
|
QdsConfig qdsConfig = qdsConfigService.getOne(null);
|
||||||
|
if(qdsConfig!=null && qdsConfig.getIsOpen() == 1){
|
||||||
|
orders.setQdsUserId(qdsInfo.getUserId());
|
||||||
|
orders.setQdsUserName(qdsInfo.getUserName());
|
||||||
|
qdsjsfdbl = qdsConfig.getArtificerRate();
|
||||||
|
//开始计算渠道商分佣
|
||||||
|
BigDecimal qdsMoney = subtract.multiply(qdsbl).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setQdsCodeMoney(qdsMoney);
|
||||||
|
BigDecimal qdsArtificerDeductMoney = qdsMoney.multiply(qdsjsfdbl).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setQdsArtificerDeductMoney(qdsArtificerDeductMoney);
|
||||||
|
|
||||||
|
//计算业务员分佣
|
||||||
|
{
|
||||||
|
//先用渠道商的业务员邀请码获取到业务员信息,判断tb_user表里是否业务员字段是否 = 1 然后看看后台业务员是否授权 再有一个看看业务员配置 功能是否已开启
|
||||||
|
UserEntity ywyUser = userService.queryByInvitationCode(qdsInfo.getBlYwyCode());
|
||||||
|
if(ywyUser != null && ywyUser.getBlIsYwy() == 1){
|
||||||
|
YwyApply ywyApply = ywyApplyService.selectByUserId(ywyUser.getUserId());
|
||||||
|
if(ywyApply != null && ywyApply.getStatus() == 1){
|
||||||
|
YwyConfig ywyConfig = ywyConfigService.getOne(null);
|
||||||
|
if(ywyConfig!= null && ywyConfig.getIsOpen() == 1){
|
||||||
|
orders.setYwyUserId(ywyUser.getUserId());
|
||||||
|
orders.setYwyUserName(ywyUser.getUserName());
|
||||||
|
//正式开始计算业务员分佣
|
||||||
|
//开始计算渠道商分佣
|
||||||
|
BigDecimal ywyMoney = subtract.multiply(ywyApply.getRate()).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
if(ywyConfig.getType() == 2){
|
||||||
|
//业务员分佣金额大于渠道商分佣金额
|
||||||
|
if(ywyMoney.compareTo(qdsMoney) == 1){
|
||||||
|
ywyMoney = ywyMoney.subtract(qdsMoney);
|
||||||
|
}else{
|
||||||
|
//业务员分佣金额小于等于渠道商分佣金额
|
||||||
|
ywyMoney = new BigDecimal(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
orders.setYwyCodeMoney(ywyMoney);
|
||||||
|
BigDecimal ywyArtificerDeductMoney = ywyMoney.multiply(ywyConfig.getArtificerRate()).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
orders.setYwyArtificerDeductMoney(ywyArtificerDeductMoney);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
|
// artificerPrice = artificerPrice.subtract(oneArtificerMoney);
|
||||||
artificerPrice = artificerPrice.subtract(orders.getJjrArtificerDeductMoney());
|
artificerPrice = artificerPrice.subtract(orders.getJjrArtificerDeductMoney());
|
||||||
artificerPrice = artificerPrice.subtract(shopMoney);
|
artificerPrice = artificerPrice.subtract(shopMoney);
|
||||||
// artificerPrice = artificerPrice.subtract(oneUserMoney);
|
// artificerPrice = artificerPrice.subtract(oneUserMoney);
|
||||||
artificerPrice = artificerPrice.subtract(orders.getFxyOneArtificerDeductMoney());//减掉一级分销商分佣技师承担
|
artificerPrice = artificerPrice.subtract(orders.getFxyOneArtificerDeductMoney());//减掉一级分销商分佣技师承担
|
||||||
artificerPrice = artificerPrice.subtract(orders.getFxyTwoArtificerDeductMoney());//减掉二级分销商分佣技师承担
|
artificerPrice = artificerPrice.subtract(orders.getFxyTwoArtificerDeductMoney());//减掉二级分销商分佣技师承担
|
||||||
|
artificerPrice = artificerPrice.subtract(orders.getQdsArtificerDeductMoney());//减去渠道商分佣 技师承担金额
|
||||||
|
artificerPrice = artificerPrice.subtract(orders.getYwyArtificerDeductMoney());//减去业务员分佣 技师承担金额
|
||||||
|
|
||||||
if(orders.getIsSupplement()!=null && orders.getIsSupplement().equals(2)){
|
if(orders.getIsSupplement()!=null && orders.getIsSupplement().equals(2)){
|
||||||
}else{
|
}else{
|
||||||
//用户收益加上通行费用
|
//用户收益加上通行费用
|
||||||
|
@ -2953,6 +3070,8 @@ public class WxServiceImpl implements WxService {
|
||||||
// pingMoney = pingMoney.subtract(oneUserMoney);
|
// pingMoney = pingMoney.subtract(oneUserMoney);
|
||||||
pingMoney = pingMoney.subtract(orders.getFxyOneMoney());//减掉一级分销商分佣
|
pingMoney = pingMoney.subtract(orders.getFxyOneMoney());//减掉一级分销商分佣
|
||||||
pingMoney = pingMoney.subtract(orders.getFxyTwoMoney());//减掉二级分销商分佣
|
pingMoney = pingMoney.subtract(orders.getFxyTwoMoney());//减掉二级分销商分佣
|
||||||
|
pingMoney = pingMoney.subtract(orders.getQdsCodeMoney());//减掉渠道商分佣
|
||||||
|
pingMoney = pingMoney.subtract(orders.getYwyCodeMoney());//减掉业务员分佣
|
||||||
orders.setPingMoney(pingMoney);
|
orders.setPingMoney(pingMoney);
|
||||||
|
|
||||||
ordersService.updateById(orders);
|
ordersService.updateById(orders);
|
||||||
|
@ -3028,6 +3147,8 @@ public class WxServiceImpl implements WxService {
|
||||||
orders1.setAddJjrArtificerDeductMoney(orders1.getAddJjrArtificerDeductMoney().add(orders.getJjrArtificerDeductMoney()));
|
orders1.setAddJjrArtificerDeductMoney(orders1.getAddJjrArtificerDeductMoney().add(orders.getJjrArtificerDeductMoney()));
|
||||||
orders1.setAddFxyOneArtificerDeductMoney(orders1.getAddFxyOneArtificerDeductMoney().add(orders.getFxyOneArtificerDeductMoney()));
|
orders1.setAddFxyOneArtificerDeductMoney(orders1.getAddFxyOneArtificerDeductMoney().add(orders.getFxyOneArtificerDeductMoney()));
|
||||||
orders1.setAddFxyTwoArtificerDeductMoney(orders1.getAddFxyTwoArtificerDeductMoney().add(orders.getFxyTwoArtificerDeductMoney()));
|
orders1.setAddFxyTwoArtificerDeductMoney(orders1.getAddFxyTwoArtificerDeductMoney().add(orders.getFxyTwoArtificerDeductMoney()));
|
||||||
|
orders1.setAddQdsArtificerDeductMoney(orders1.getAddQdsArtificerDeductMoney().add(orders.getQdsArtificerDeductMoney()));
|
||||||
|
orders1.setAddYwyArtificerDeductMoney(orders1.getAddYwyArtificerDeductMoney().add(orders.getYwyArtificerDeductMoney()));
|
||||||
}else{
|
}else{
|
||||||
orders1.setAddMoney(orders.getPayMoney());
|
orders1.setAddMoney(orders.getPayMoney());
|
||||||
orders1.setAddArtificerMoney(orders.getArtificerMoney());
|
orders1.setAddArtificerMoney(orders.getArtificerMoney());
|
||||||
|
@ -3039,6 +3160,8 @@ public class WxServiceImpl implements WxService {
|
||||||
orders1.setAddJjrArtificerDeductMoney(orders.getJjrArtificerDeductMoney());
|
orders1.setAddJjrArtificerDeductMoney(orders.getJjrArtificerDeductMoney());
|
||||||
orders1.setAddFxyOneArtificerDeductMoney(orders.getFxyOneArtificerDeductMoney());
|
orders1.setAddFxyOneArtificerDeductMoney(orders.getFxyOneArtificerDeductMoney());
|
||||||
orders1.setAddFxyTwoArtificerDeductMoney(orders.getFxyTwoArtificerDeductMoney());
|
orders1.setAddFxyTwoArtificerDeductMoney(orders.getFxyTwoArtificerDeductMoney());
|
||||||
|
orders1.setAddQdsArtificerDeductMoney(orders.getQdsArtificerDeductMoney());
|
||||||
|
orders1.setAddYwyArtificerDeductMoney(orders.getYwyArtificerDeductMoney());
|
||||||
}
|
}
|
||||||
orders1.setSumMoney(orders1.getSumMoney().add(orders.getPayMoney()));
|
orders1.setSumMoney(orders1.getSumMoney().add(orders.getPayMoney()));
|
||||||
orders1.setSumArtificerMoney(orders1.getSumArtificerMoney().add(orders.getArtificerMoney()));
|
orders1.setSumArtificerMoney(orders1.getSumArtificerMoney().add(orders.getArtificerMoney()));
|
||||||
|
@ -3051,6 +3174,8 @@ public class WxServiceImpl implements WxService {
|
||||||
// orders1.setFxyTwoMoney(orders1.getFxyTwoMoney().add(orders.getFxyTwoMoney()));
|
// orders1.setFxyTwoMoney(orders1.getFxyTwoMoney().add(orders.getFxyTwoMoney()));
|
||||||
// orders1.setFxyOneArtificerDeductMoney(orders1.getFxyOneArtificerDeductMoney().add(orders.getFxyOneArtificerDeductMoney()));
|
// orders1.setFxyOneArtificerDeductMoney(orders1.getFxyOneArtificerDeductMoney().add(orders.getFxyOneArtificerDeductMoney()));
|
||||||
// orders1.setFxyTwoArtificerDeductMoney(orders1.getFxyTwoArtificerDeductMoney().add(orders.getFxyTwoArtificerDeductMoney()));
|
// orders1.setFxyTwoArtificerDeductMoney(orders1.getFxyTwoArtificerDeductMoney().add(orders.getFxyTwoArtificerDeductMoney()));
|
||||||
|
// orders1.setPingMoney(orders1.getPingMoney().add(orders.getPingMoney()));
|
||||||
|
// orders1.setYwyCodeMoney(orders1.getYwyCodeMoney().add(orders.getYwyCodeMoney()));
|
||||||
// orders1.setPingMoney(orders1.getPingMoney().add(orders.getPingMoney()));
|
// orders1.setPingMoney(orders1.getPingMoney().add(orders.getPingMoney()));
|
||||||
|
|
||||||
if(orders1.getStatus().equals(6)){
|
if(orders1.getStatus().equals(6)){
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.sqx.modules.shopping.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.sqx.modules.common.service.CommonInfoService;
|
import com.sqx.modules.common.service.CommonInfoService;
|
||||||
|
import com.sqx.modules.coupon.entity.Coupon;
|
||||||
import com.sqx.modules.shopping.controller.SkuUtil;
|
import com.sqx.modules.shopping.controller.SkuUtil;
|
||||||
import com.sqx.modules.shopping.dao.*;
|
import com.sqx.modules.shopping.dao.*;
|
||||||
import com.sqx.modules.shopping.entity.*;
|
import com.sqx.modules.shopping.entity.*;
|
||||||
|
@ -20,10 +21,7 @@ import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
import javax.persistence.criteria.*;
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
|
||||||
import javax.persistence.criteria.Predicate;
|
|
||||||
import javax.persistence.criteria.Root;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -524,16 +522,41 @@ public class SelfGoodsServiceImpl implements GoodsService {
|
||||||
}
|
}
|
||||||
Pageable pageable = PageRequest.of(page, size, Sort.by(order));
|
Pageable pageable = PageRequest.of(page, size, Sort.by(order));
|
||||||
//构造自定义查询条件
|
//构造自定义查询条件
|
||||||
|
// Specification<SelfGoods> queryCondition = new Specification<SelfGoods>() {
|
||||||
|
// @Override
|
||||||
|
// public Predicate toPredicate(Root<SelfGoods> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
|
||||||
|
// List<Predicate> predicateList = new ArrayList<>();
|
||||||
|
// predicateList.add(criteriaBuilder.equal(root.get("isRecommend"), 1)); //每日推荐
|
||||||
|
// predicateList.add(criteriaBuilder.equal(root.get("status"), 1)); //上架
|
||||||
|
// return criteriaBuilder.and(predicateList.toArray(new Predicate[predicateList.size()]));
|
||||||
|
// }
|
||||||
|
// };
|
||||||
Specification<SelfGoods> queryCondition = new Specification<SelfGoods>() {
|
Specification<SelfGoods> queryCondition = new Specification<SelfGoods>() {
|
||||||
@Override
|
@Override
|
||||||
public Predicate toPredicate(Root<SelfGoods> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
|
public Predicate toPredicate(Root<SelfGoods> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
|
||||||
List<Predicate> predicateList = new ArrayList<>();
|
List<Predicate> predicateList = new ArrayList<>();
|
||||||
predicateList.add(criteriaBuilder.equal(root.get("isRecommend"), 1)); //每日推荐
|
|
||||||
predicateList.add(criteriaBuilder.equal(root.get("status"), 1)); //上架
|
// 添加 SelfGoods 表的查询条件
|
||||||
return criteriaBuilder.and(predicateList.toArray(new Predicate[predicateList.size()]));
|
predicateList.add(criteriaBuilder.equal(root.get("isRecommend"), 1)); // 每日推荐
|
||||||
|
predicateList.add(criteriaBuilder.equal(root.get("status"), 1)); // 上架
|
||||||
|
|
||||||
|
// 创建子查询检查 Coupon 表中是否有对应记录且 goodsId 不为空
|
||||||
|
Subquery<Long> subquery = criteriaQuery.subquery(Long.class);
|
||||||
|
Root<Coupon> couponRoot = subquery.from(Coupon.class);
|
||||||
|
subquery.select(couponRoot.get("goodsId")); // 假设 goodsId 是 Long 类型
|
||||||
|
subquery.where(
|
||||||
|
criteriaBuilder.equal(couponRoot.get("goodsId"), root.get("id")),
|
||||||
|
criteriaBuilder.isNotNull(couponRoot.get("goodsId"))
|
||||||
|
);
|
||||||
|
|
||||||
|
// 将子查询作为 exists 条件添加到主查询
|
||||||
|
predicateList.add(criteriaBuilder.exists(subquery));
|
||||||
|
|
||||||
|
return criteriaBuilder.and(predicateList.toArray(new Predicate[]{}));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return ResultUtil.success(jpaRepository.findAll(queryCondition, pageable));
|
Page<SelfGoods> all = jpaRepository.findAll(queryCondition, pageable);
|
||||||
|
return ResultUtil.success(all);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,6 +19,7 @@ import com.sqx.modules.bl.userZxsc.entity.BlUserZxsc;
|
||||||
import com.sqx.modules.common.dao.CommonInfoDao;
|
import com.sqx.modules.common.dao.CommonInfoDao;
|
||||||
import com.sqx.modules.common.entity.CommonInfo;
|
import com.sqx.modules.common.entity.CommonInfo;
|
||||||
import com.sqx.modules.task.service.AllTaskSercice;
|
import com.sqx.modules.task.service.AllTaskSercice;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
@ -31,6 +32,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@Slf4j
|
||||||
public class AllTaskServiceImpl implements AllTaskSercice {
|
public class AllTaskServiceImpl implements AllTaskSercice {
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,30 +77,31 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
||||||
// @Scheduled(cron = "0 * * * * ?")
|
// @Scheduled(cron = "0 * * * * ?")
|
||||||
@Scheduled(cron = "0 00 04 * * ?")
|
@Scheduled(cron = "0 00 04 * * ?")
|
||||||
public void upgradeJishi() {
|
public void upgradeJishi() {
|
||||||
System.out.println("------------计算技师升级规则-----------");
|
log.info("------------开始计算技师升级规则-----------");
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
//新手技师
|
//新手技师
|
||||||
List<Artificer> xsList = artificerDao.getXsList();
|
List<Artificer> xsList = artificerDao.getXsList();
|
||||||
if(xsList.size()>0){
|
if (xsList.size() > 0) {
|
||||||
|
log.info("新手技师列表大小: {}", xsList.size());
|
||||||
QueryWrapper<ArtificerPartitioningDetails> sjgzQuery = new QueryWrapper<ArtificerPartitioningDetails>();
|
QueryWrapper<ArtificerPartitioningDetails> sjgzQuery = new QueryWrapper<ArtificerPartitioningDetails>();
|
||||||
sjgzQuery.ne("grade","新");
|
sjgzQuery.ne("grade", "新");
|
||||||
sjgzQuery.orderByAsc("id");
|
sjgzQuery.orderByAsc("id");
|
||||||
sjgzQuery.last("limit 1");
|
sjgzQuery.last("limit 1");
|
||||||
ArtificerPartitioningDetails jsdj = artificerPartitioningDetailsDao.selectOne(sjgzQuery);
|
ArtificerPartitioningDetails jsdj = artificerPartitioningDetailsDao.selectOne(sjgzQuery);
|
||||||
for(Artificer artificer : xsList){
|
for (Artificer artificer : xsList) {
|
||||||
String createTime = artificer.getCreateTime();
|
String createTime = artificer.getCreateTime();
|
||||||
Date date = DateUtils.stringToDate(createTime,DateUtils.DATE_TIME_PATTERN);
|
Date date = DateUtils.stringToDate(createTime, DateUtils.DATE_TIME_PATTERN);
|
||||||
date = DateUtils.addDateDays(date,7);
|
date = DateUtils.addDateDays(date, 7);
|
||||||
Date current = calendar.getTime();
|
Date current = calendar.getTime();
|
||||||
if(current.getTime()>=date.getTime()){
|
if (current.getTime() >= date.getTime()) {
|
||||||
artificer.setGrade(jsdj.getGrade());
|
artificer.setGrade(jsdj.getGrade());
|
||||||
QueryWrapper<BlArtificerZqhz> zqhzQuery = new QueryWrapper<BlArtificerZqhz>();
|
QueryWrapper<BlArtificerZqhz> zqhzQuery = new QueryWrapper<BlArtificerZqhz>();
|
||||||
sjgzQuery.eq("artificer_id",artificer.getArtificerId());
|
sjgzQuery.eq("artificer_id", artificer.getArtificerId());
|
||||||
sjgzQuery.orderByDesc("id");
|
sjgzQuery.orderByDesc("id");
|
||||||
sjgzQuery.last("limit 1");
|
sjgzQuery.last("limit 1");
|
||||||
BlArtificerZqhz blArtificerZqhz = blArtificerZqhzDao.selectOne(zqhzQuery);
|
BlArtificerZqhz blArtificerZqhz = blArtificerZqhzDao.selectOne(zqhzQuery);
|
||||||
if(blArtificerZqhz!=null){
|
if (blArtificerZqhz != null) {
|
||||||
if(blArtificerZqhz.getGrade()!=null&&!blArtificerZqhz.getGrade().equals("")){
|
if (blArtificerZqhz.getGrade() != null && !blArtificerZqhz.getGrade().equals("")) {
|
||||||
artificer.setGrade(blArtificerZqhz.getGrade());
|
artificer.setGrade(blArtificerZqhz.getGrade());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,7 +115,7 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
||||||
String startTime = "";
|
String startTime = "";
|
||||||
String endTime = "";
|
String endTime = "";
|
||||||
//获取执行时间
|
//获取执行时间
|
||||||
if(dayOfMonth == 1){
|
if (dayOfMonth == 1) {
|
||||||
Calendar calendar4 = Calendar.getInstance();
|
Calendar calendar4 = Calendar.getInstance();
|
||||||
calendar4.set(Calendar.DAY_OF_MONTH, 1);
|
calendar4.set(Calendar.DAY_OF_MONTH, 1);
|
||||||
calendar4.add(Calendar.DAY_OF_MONTH, -1);
|
calendar4.add(Calendar.DAY_OF_MONTH, -1);
|
||||||
|
@ -121,50 +124,50 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
||||||
calendar2.add(Calendar.MONTH, -1); // 获取上个月
|
calendar2.add(Calendar.MONTH, -1); // 获取上个月
|
||||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
|
||||||
String lastMonth = format.format(calendar2.getTime());
|
String lastMonth = format.format(calendar2.getTime());
|
||||||
startTime = lastMonth+"-16 00:00:00";
|
startTime = lastMonth + "-16 00:00:00";
|
||||||
endTime = lastMonth+"-"+lastDayOfMonth+" 23:59:59";
|
endTime = lastMonth + "-" + lastDayOfMonth + " 23:59:59";
|
||||||
}else if(dayOfMonth == 16){
|
} else if (dayOfMonth == 16) {
|
||||||
Calendar calendar4 = Calendar.getInstance();
|
Calendar calendar4 = Calendar.getInstance();
|
||||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
|
||||||
String lastMonth = format.format(calendar4.getTime());
|
String lastMonth = format.format(calendar4.getTime());
|
||||||
startTime = lastMonth+"-01 00:00:00";
|
startTime = lastMonth + "-01 00:00:00";
|
||||||
endTime = lastMonth+"-15 23:59:59";
|
endTime = lastMonth + "-15 23:59:59";
|
||||||
}
|
}
|
||||||
|
|
||||||
// startTime = "2024-06-21 00:00:00";
|
// startTime = "2024-06-21 00:00:00";
|
||||||
// endTime = "2024-06-30 23:59:59";
|
// endTime = "2024-06-30 23:59:59";
|
||||||
//不为空则继续执行,否则不到时间不计算升级规则
|
//不为空则继续执行,否则不到时间不计算升级规则
|
||||||
if(StringUtils.isNotEmpty(startTime)){
|
if (StringUtils.isNotEmpty(startTime)) {
|
||||||
//2.获取全部参与积分规则的技师
|
//2.获取全部参与积分规则的技师
|
||||||
List<Artificer> jslist = artificerDao.getYxjsList();
|
List<Artificer> jslist = artificerDao.getYxjsList();
|
||||||
//3.查询升级规则配置表
|
//3.查询升级规则配置表
|
||||||
QueryWrapper<ArtificerPartitioningDetails> sjgzQuery = new QueryWrapper<ArtificerPartitioningDetails>();
|
QueryWrapper<ArtificerPartitioningDetails> sjgzQuery = new QueryWrapper<ArtificerPartitioningDetails>();
|
||||||
sjgzQuery.ne("grade","新");
|
sjgzQuery.ne("grade", "新");
|
||||||
sjgzQuery.orderByDesc("outstanding_achievement","duration_online");
|
sjgzQuery.orderByDesc("outstanding_achievement", "duration_online");
|
||||||
List<ArtificerPartitioningDetails> sjgzAllList = artificerPartitioningDetailsDao.selectList(sjgzQuery);
|
List<ArtificerPartitioningDetails> sjgzAllList = artificerPartitioningDetailsDao.selectList(sjgzQuery);
|
||||||
//4.根据技师的服务类型查找对应的配置规则,
|
//4.根据技师的服务类型查找对应的配置规则,
|
||||||
for (Artificer jsPar : jslist) {
|
for (Artificer jsPar : jslist) {
|
||||||
//获取技师是否参与积分规则,如果参与积分规则则继续执行,否则不变分成比例
|
//获取技师是否参与积分规则,如果参与积分规则则继续执行,否则不变分成比例
|
||||||
//业绩、积分、收入
|
//业绩、积分、收入
|
||||||
ArtificerIntegralStatistics artificerIntegralStatistics = artificerIntegralStatisticsDao.getIntegralStatistics(jsPar.getArtificerId(),startTime,endTime,null);
|
ArtificerIntegralStatistics artificerIntegralStatistics = artificerIntegralStatisticsDao.getIntegralStatistics(jsPar.getArtificerId(), startTime, endTime, null);
|
||||||
BigDecimal outstandingAchievement = BigDecimal.ZERO;
|
BigDecimal outstandingAchievement = BigDecimal.ZERO;
|
||||||
BigDecimal integral = BigDecimal.ZERO;
|
BigDecimal integral = BigDecimal.ZERO;
|
||||||
BigDecimal income = BigDecimal.ZERO;
|
BigDecimal income = BigDecimal.ZERO;
|
||||||
if(artificerIntegralStatistics!=null){
|
if (artificerIntegralStatistics != null) {
|
||||||
if(artificerIntegralStatistics.getAchievement()!=null){
|
if (artificerIntegralStatistics.getAchievement() != null) {
|
||||||
outstandingAchievement = artificerIntegralStatistics.getAchievement();
|
outstandingAchievement = artificerIntegralStatistics.getAchievement();
|
||||||
}
|
}
|
||||||
if(artificerIntegralStatistics.getIntegral()!=null){
|
if (artificerIntegralStatistics.getIntegral() != null) {
|
||||||
integral = artificerIntegralStatistics.getIntegral();
|
integral = artificerIntegralStatistics.getIntegral();
|
||||||
}
|
}
|
||||||
if(artificerIntegralStatistics.getIncome()!=null){
|
if (artificerIntegralStatistics.getIncome() != null) {
|
||||||
income = artificerIntegralStatistics.getIncome();
|
income = artificerIntegralStatistics.getIncome();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//在线时长
|
//在线时长
|
||||||
ArtificerIntegralStatistics zxscStatistics = artificerIntegralStatisticsDao.getIntegralStatistics(jsPar.getArtificerId(),startTime,endTime,1);
|
ArtificerIntegralStatistics zxscStatistics = artificerIntegralStatisticsDao.getIntegralStatistics(jsPar.getArtificerId(), startTime, endTime, 1);
|
||||||
BigDecimal zxscjf = BigDecimal.ZERO;
|
BigDecimal zxscjf = BigDecimal.ZERO;
|
||||||
if(zxscStatistics!=null){
|
if (zxscStatistics != null) {
|
||||||
zxscjf = zxscStatistics.getIntegral();
|
zxscjf = zxscStatistics.getIntegral();
|
||||||
}
|
}
|
||||||
//多少分钟等1积分
|
//多少分钟等1积分
|
||||||
|
@ -174,7 +177,7 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
||||||
|
|
||||||
String jsdj = "";//等级
|
String jsdj = "";//等级
|
||||||
BigDecimal rate = BigDecimal.valueOf(0);
|
BigDecimal rate = BigDecimal.valueOf(0);
|
||||||
for (ArtificerPartitioningDetails sjgzPar : sjgzAllList){
|
for (ArtificerPartitioningDetails sjgzPar : sjgzAllList) {
|
||||||
//当技师的服务类型=升级规则的服务类型,才可以添加到升级规则里去
|
//当技师的服务类型=升级规则的服务类型,才可以添加到升级规则里去
|
||||||
//最低业绩
|
//最低业绩
|
||||||
BigDecimal zddjPar = sjgzPar.getOutstandingAchievement();
|
BigDecimal zddjPar = sjgzPar.getOutstandingAchievement();
|
||||||
|
@ -183,38 +186,38 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
||||||
//在线时长
|
//在线时长
|
||||||
BigDecimal zxscPar = new BigDecimal(sjgzPar.getDurationOnline());
|
BigDecimal zxscPar = new BigDecimal(sjgzPar.getDurationOnline());
|
||||||
|
|
||||||
if(outstandingAchievement.compareTo(zddjPar)>=0&&integral.compareTo(czjfPar)>=0&&zxcs.compareTo(zxscPar)>=0){
|
if (outstandingAchievement.compareTo(zddjPar) >= 0 && integral.compareTo(czjfPar) >= 0 && zxcs.compareTo(zxscPar) >= 0) {
|
||||||
jsdj = sjgzPar.getGrade();
|
jsdj = sjgzPar.getGrade();
|
||||||
rate = BigDecimal.valueOf(Double.parseDouble(sjgzPar.getProportionalSharing()));
|
rate = BigDecimal.valueOf(Double.parseDouble(sjgzPar.getProportionalSharing()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//如果都不符合,则给最低等级(保底)
|
//如果都不符合,则给最低等级(保底)
|
||||||
if(StringUtils.isEmpty(jsdj)){
|
if (StringUtils.isEmpty(jsdj)) {
|
||||||
QueryWrapper<ArtificerPartitioningDetails> sjgzQuery1 = new QueryWrapper<ArtificerPartitioningDetails>();
|
QueryWrapper<ArtificerPartitioningDetails> sjgzQuery1 = new QueryWrapper<ArtificerPartitioningDetails>();
|
||||||
sjgzQuery.ne("grade","新");
|
sjgzQuery.ne("grade", "新");
|
||||||
sjgzQuery.orderByAsc("id");
|
sjgzQuery.orderByAsc("id");
|
||||||
sjgzQuery.last("limit 1");
|
sjgzQuery.last("limit 1");
|
||||||
List<ArtificerPartitioningDetails> zddjgz = artificerPartitioningDetailsDao.selectList(sjgzQuery1);
|
List<ArtificerPartitioningDetails> zddjgz = artificerPartitioningDetailsDao.selectList(sjgzQuery1);
|
||||||
if(zddjgz!=null && zddjgz.size()>0){
|
if (zddjgz != null && zddjgz.size() > 0) {
|
||||||
jsdj = zddjgz.get(0).getGrade();
|
jsdj = zddjgz.get(0).getGrade();
|
||||||
rate = new BigDecimal(zddjgz.get(0).getProportionalSharing());
|
rate = new BigDecimal(zddjgz.get(0).getProportionalSharing());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(StringUtils.isEmpty(jsdj)){
|
if (StringUtils.isEmpty(jsdj)) {
|
||||||
jsdj = "T0";
|
jsdj = "T0";
|
||||||
rate = BigDecimal.valueOf(0.5);
|
rate = BigDecimal.valueOf(0.5);
|
||||||
}
|
}
|
||||||
if(StringUtils.isNotEmpty(jsdj)){
|
if (StringUtils.isNotEmpty(jsdj)) {
|
||||||
if(jsPar.getGrade().equals("新")){
|
if (jsPar.getGrade().equals("新")) {
|
||||||
if(rate.compareTo(jsPar.getRate())>=0){
|
if (rate.compareTo(jsPar.getRate()) >= 0) {
|
||||||
Artificer jsUp = new Artificer();
|
Artificer jsUp = new Artificer();
|
||||||
jsUp.setRate(rate);
|
jsUp.setRate(rate);
|
||||||
jsUp.setGrade(jsdj);
|
jsUp.setGrade(jsdj);
|
||||||
jsUp.setArtificerId(jsPar.getArtificerId());
|
jsUp.setArtificerId(jsPar.getArtificerId());
|
||||||
artificerDao.updateById(jsUp);
|
artificerDao.updateById(jsUp);
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
Artificer jsUp = new Artificer();
|
Artificer jsUp = new Artificer();
|
||||||
jsUp.setRate(rate);
|
jsUp.setRate(rate);
|
||||||
jsUp.setGrade(jsdj);
|
jsUp.setGrade(jsdj);
|
||||||
|
@ -225,9 +228,9 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
||||||
|
|
||||||
//技师汇总逻辑
|
//技师汇总逻辑
|
||||||
QueryWrapper<BlArtificerZqhz> blArtificerZqhzQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<BlArtificerZqhz> blArtificerZqhzQueryWrapper = new QueryWrapper<>();
|
||||||
blArtificerZqhzQueryWrapper.eq("artificer_id",jsPar.getArtificerId());
|
blArtificerZqhzQueryWrapper.eq("artificer_id", jsPar.getArtificerId());
|
||||||
blArtificerZqhzQueryWrapper.ge("start_time",startTime);
|
blArtificerZqhzQueryWrapper.ge("start_time", startTime);
|
||||||
blArtificerZqhzQueryWrapper.le("end_time",endTime);
|
blArtificerZqhzQueryWrapper.le("end_time", endTime);
|
||||||
blArtificerZqhzDao.delete(blArtificerZqhzQueryWrapper);
|
blArtificerZqhzDao.delete(blArtificerZqhzQueryWrapper);
|
||||||
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
@ -239,14 +242,15 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
blArtificerZqhz.setXsje(income+""); //销售金额
|
blArtificerZqhz.setXsje(income + ""); //销售金额
|
||||||
blArtificerZqhz.setYj(outstandingAchievement+""); //业绩
|
blArtificerZqhz.setYj(outstandingAchievement + ""); //业绩
|
||||||
blArtificerZqhz.setZxsc(zxcs+"");//在线时长
|
blArtificerZqhz.setZxsc(zxcs + "");//在线时长
|
||||||
blArtificerZqhz.setJf(integral+"");//积分
|
blArtificerZqhz.setJf(integral + "");//积分
|
||||||
blArtificerZqhz.setGrade(jsdj);//等级
|
blArtificerZqhz.setGrade(jsdj);//等级
|
||||||
blArtificerZqhzDao.insert(blArtificerZqhz);
|
blArtificerZqhzDao.insert(blArtificerZqhz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.info("------------完成计算技师升级规则-----------");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -254,7 +258,7 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 * * * * ?")
|
@Scheduled(cron = "0 * * * * ?")
|
||||||
public void upJishiZxsc() throws ParseException {
|
public void upJishiZxsc() throws ParseException {
|
||||||
System.out.println("----------------计算技师在线时长,每10分钟计算一积分-------------");
|
log.info("----------------开始计算技师在线时长,每10分钟计算一积分-------------");
|
||||||
CommonInfo commonInfo = commonInfoDao.findOne(100000);
|
CommonInfo commonInfo = commonInfoDao.findOne(100000);
|
||||||
String minute = commonInfo.getValue();//多少分钟等于1积分
|
String minute = commonInfo.getValue();//多少分钟等于1积分
|
||||||
|
|
||||||
|
@ -263,28 +267,28 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
||||||
List<Artificer> artificerList = artificerDao.selectInlineList(artificer);
|
List<Artificer> artificerList = artificerDao.selectInlineList(artificer);
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
for(Artificer par:artificerList){
|
for (Artificer par : artificerList) {
|
||||||
//取最新的一回的获得积分时间
|
//取最新的一回的获得积分时间
|
||||||
QueryWrapper<BlUserZxsc> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<BlUserZxsc> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("artificer_id",par.getArtificerId());
|
queryWrapper.eq("artificer_id", par.getArtificerId());
|
||||||
queryWrapper.orderByDesc("create_time");
|
queryWrapper.orderByDesc("create_time");
|
||||||
queryWrapper.last("limit 1");
|
queryWrapper.last("limit 1");
|
||||||
BlUserZxsc blUserZxsc = blUserZxscDao.selectOne(queryWrapper);
|
BlUserZxsc blUserZxsc = blUserZxscDao.selectOne(queryWrapper);
|
||||||
if(blUserZxsc == null){
|
if (blUserZxsc == null) {
|
||||||
BigDecimal recharge = new BigDecimal(1);
|
BigDecimal recharge = new BigDecimal(1);
|
||||||
BlUserZxsc newBlUserZxsc = new BlUserZxsc();
|
BlUserZxsc newBlUserZxsc = new BlUserZxsc();
|
||||||
newBlUserZxsc.setArtificerId(par.getArtificerId());
|
newBlUserZxsc.setArtificerId(par.getArtificerId());
|
||||||
newBlUserZxsc.setUserRecharge(recharge);
|
newBlUserZxsc.setUserRecharge(recharge);
|
||||||
newBlUserZxsc.setCreateTime(sdf.format(new Date()));
|
newBlUserZxsc.setCreateTime(sdf.format(new Date()));
|
||||||
blUserZxscDao.insert(newBlUserZxsc);
|
blUserZxscDao.insert(newBlUserZxsc);
|
||||||
}else{
|
} else {
|
||||||
String createTime = blUserZxsc.getCreateTime();
|
String createTime = blUserZxsc.getCreateTime();
|
||||||
//上一回时间加十分钟
|
//上一回时间加十分钟
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.setTime(sdf.parse(createTime));
|
calendar.setTime(sdf.parse(createTime));
|
||||||
calendar.add(Calendar.MINUTE, Integer.parseInt(minute));
|
calendar.add(Calendar.MINUTE, Integer.parseInt(minute));
|
||||||
Date nextDate = calendar.getTime();
|
Date nextDate = calendar.getTime();
|
||||||
if (now.getTime()>=nextDate.getTime()) {//nowTime < newTime
|
if (now.getTime() >= nextDate.getTime()) {//nowTime < newTime
|
||||||
BigDecimal recharge = new BigDecimal(1);
|
BigDecimal recharge = new BigDecimal(1);
|
||||||
BlUserZxsc newBlUserZxsc = new BlUserZxsc();
|
BlUserZxsc newBlUserZxsc = new BlUserZxsc();
|
||||||
newBlUserZxsc.setArtificerId(par.getArtificerId());
|
newBlUserZxsc.setArtificerId(par.getArtificerId());
|
||||||
|
@ -295,6 +299,7 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
log.info("----------------完成计算技师在线时长,每10分钟计算一积分-------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -302,7 +307,7 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 0 0 * * ?")
|
@Scheduled(cron = "0 0 0 * * ?")
|
||||||
public void tongjiJishiGrade() {
|
public void tongjiJishiGrade() {
|
||||||
System.out.println("----------------每日积分汇总 定时任务-------------");
|
log.info("----------------开始每日积分汇总 定时任务-------------");
|
||||||
//当前时间减一天
|
//当前时间减一天
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.add(Calendar.DAY_OF_YEAR, -1);//上一天
|
calendar.add(Calendar.DAY_OF_YEAR, -1);//上一天
|
||||||
|
@ -313,13 +318,13 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
||||||
blUserZxscParam.setCreateTime(date);
|
blUserZxscParam.setCreateTime(date);
|
||||||
List<BlUserZxsc> blUserZxsc = blUserZxscDao.selectGrouplist(blUserZxscParam);
|
List<BlUserZxsc> blUserZxsc = blUserZxscDao.selectGrouplist(blUserZxscParam);
|
||||||
String dateStr = sdf2.format(calendar.getTime());
|
String dateStr = sdf2.format(calendar.getTime());
|
||||||
for(BlUserZxsc blUserZxscPar:blUserZxsc){
|
for (BlUserZxsc blUserZxscPar : blUserZxsc) {
|
||||||
|
|
||||||
QueryWrapper<UserRecharge> delWrapper = new QueryWrapper<UserRecharge>();
|
QueryWrapper<UserRecharge> delWrapper = new QueryWrapper<UserRecharge>();
|
||||||
delWrapper.eq("artificer_id",blUserZxscPar.getArtificerId());
|
delWrapper.eq("artificer_id", blUserZxscPar.getArtificerId());
|
||||||
delWrapper.eq("type",1);
|
delWrapper.eq("type", 1);
|
||||||
delWrapper.ge("create_time",date);
|
delWrapper.ge("create_time", date);
|
||||||
delWrapper.le("create_time",date+" 23:59:59");
|
delWrapper.le("create_time", date + " 23:59:59");
|
||||||
userRechargeDao.delete(delWrapper);
|
userRechargeDao.delete(delWrapper);
|
||||||
|
|
||||||
UserRecharge userRecharge = new UserRecharge();
|
UserRecharge userRecharge = new UserRecharge();
|
||||||
|
@ -330,6 +335,7 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
||||||
userRecharge.setCreateTime(dateStr);
|
userRecharge.setCreateTime(dateStr);
|
||||||
userRechargeDao.insert(userRecharge);
|
userRechargeDao.insert(userRecharge);
|
||||||
}
|
}
|
||||||
|
log.info("----------------完成每日积分汇总 定时任务-------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -337,7 +343,7 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 0 1 * * ?")
|
@Scheduled(cron = "0 0 1 * * ?")
|
||||||
public void tongjiIntegral() {
|
public void tongjiIntegral() {
|
||||||
System.out.println("----------------每日积业绩及分汇总 定时任务-------------");
|
log.info("----------------开始每日业绩及积分汇总 定时任务-------------");
|
||||||
//当前时间减一天
|
//当前时间减一天
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.add(Calendar.DAY_OF_YEAR, -1);//上一天
|
calendar.add(Calendar.DAY_OF_YEAR, -1);//上一天
|
||||||
|
@ -348,12 +354,12 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
||||||
blUserZxscParam.setCreateTime(date);
|
blUserZxscParam.setCreateTime(date);
|
||||||
//获取在线积分
|
//获取在线积分
|
||||||
List<BlUserZxsc> blUserZxsc = blUserZxscDao.selectGrouplist(blUserZxscParam);
|
List<BlUserZxsc> blUserZxsc = blUserZxscDao.selectGrouplist(blUserZxscParam);
|
||||||
for(BlUserZxsc blUserZxscPar:blUserZxsc){
|
for (BlUserZxsc blUserZxscPar : blUserZxsc) {
|
||||||
QueryWrapper<ArtificerIntegralStatistics> delWrapper = new QueryWrapper<ArtificerIntegralStatistics>();
|
QueryWrapper<ArtificerIntegralStatistics> delWrapper = new QueryWrapper<ArtificerIntegralStatistics>();
|
||||||
delWrapper.eq("artificer_id",blUserZxscPar.getArtificerId());
|
delWrapper.eq("artificer_id", blUserZxscPar.getArtificerId());
|
||||||
delWrapper.eq("classify",1);
|
delWrapper.eq("classify", 1);
|
||||||
delWrapper.ge("create_time",date);
|
delWrapper.ge("create_time", date);
|
||||||
delWrapper.le("create_time",date+" 23:59:59");
|
delWrapper.le("create_time", date + " 23:59:59");
|
||||||
artificerIntegralStatisticsDao.delete(delWrapper);
|
artificerIntegralStatisticsDao.delete(delWrapper);
|
||||||
|
|
||||||
Artificer artificer = artificerDao.selectById(blUserZxscPar.getArtificerId());
|
Artificer artificer = artificerDao.selectById(blUserZxscPar.getArtificerId());
|
||||||
|
@ -363,23 +369,24 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
||||||
artificerIntegralStatistics.setClassify(1);
|
artificerIntegralStatistics.setClassify(1);
|
||||||
artificerIntegralStatistics.setType(1);
|
artificerIntegralStatistics.setType(1);
|
||||||
artificerIntegralStatistics.setIntegral(blUserZxscPar.getUserRecharge());
|
artificerIntegralStatistics.setIntegral(blUserZxscPar.getUserRecharge());
|
||||||
artificerIntegralStatistics.setCreateTime(date+" 23:59:59");
|
artificerIntegralStatistics.setCreateTime(date + " 23:59:59");
|
||||||
artificerIntegralStatisticsDao.insert(artificerIntegralStatistics);
|
artificerIntegralStatisticsDao.insert(artificerIntegralStatistics);
|
||||||
}
|
}
|
||||||
|
log.info("----------------完成每日业绩及积分汇总 定时任务-------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
//赠送盛安豆定时任务
|
//赠送盛安豆定时任务
|
||||||
@Scheduled(cron = "0 10 0 * * ?")
|
@Scheduled(cron = "0 10 0 * * ?")
|
||||||
public void updateSadJob() {
|
public void updateSadJob() {
|
||||||
|
log.info("--------------开始赠送盛安豆定时任务--------------");
|
||||||
QueryWrapper<BlSadJob> query = new QueryWrapper<>();
|
QueryWrapper<BlSadJob> query = new QueryWrapper<>();
|
||||||
query.eq("sfwc",0);
|
query.eq("sfwc", 0);
|
||||||
List<BlSadJob> list = blSadJobService.list(query);
|
List<BlSadJob> list = blSadJobService.list(query);
|
||||||
for(BlSadJob par : list){
|
for (BlSadJob par : list) {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
String date=sdf.format(new Date());
|
String date = sdf.format(new Date());
|
||||||
userMoneyService.updateSad(1,par.getUserId(),par.getDayMoney());
|
userMoneyService.updateSad(1, par.getUserId(), par.getDayMoney());
|
||||||
UserSadDetails userMoneyDetails=new UserSadDetails();
|
UserSadDetails userMoneyDetails = new UserSadDetails();
|
||||||
//查询用户当前余额
|
//查询用户当前余额
|
||||||
UserMoney userNowMoney = userMoneyService.selectUserMoneyByUserId(par.getUserId());
|
UserMoney userNowMoney = userMoneyService.selectUserMoneyByUserId(par.getUserId());
|
||||||
//插入余额
|
//插入余额
|
||||||
|
@ -388,46 +395,48 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
||||||
userMoneyDetails.setManipulateType(2);
|
userMoneyDetails.setManipulateType(2);
|
||||||
userMoneyDetails.setUserId(par.getUserId());
|
userMoneyDetails.setUserId(par.getUserId());
|
||||||
userMoneyDetails.setTitle("[充值赠送]标题:充值");
|
userMoneyDetails.setTitle("[充值赠送]标题:充值");
|
||||||
userMoneyDetails.setContent("获得盛安豆:"+par.getDayMoney());
|
userMoneyDetails.setContent("获得盛安豆:" + par.getDayMoney());
|
||||||
userMoneyDetails.setType(1);
|
userMoneyDetails.setType(1);
|
||||||
userMoneyDetails.setMoney(userNowMoney.getSad());
|
userMoneyDetails.setMoney(userNowMoney.getSad());
|
||||||
userMoneyDetails.setCreateTime(date);
|
userMoneyDetails.setCreateTime(date);
|
||||||
userMoneyDetails.setBlRole(2);
|
userMoneyDetails.setBlRole(2);
|
||||||
userMoneyDetails.setBlFlag(1);
|
userMoneyDetails.setBlFlag(1);
|
||||||
userSadDetailsService.insert(userMoneyDetails);
|
userSadDetailsService.insert(userMoneyDetails);
|
||||||
int day = par.getDayNum()+1;
|
int day = par.getDayNum() + 1;
|
||||||
par.setDayNum(day);
|
par.setDayNum(day);
|
||||||
if(day == par.getDaySumNum()){
|
if (day == par.getDaySumNum()) {
|
||||||
par.setSfwc(1);
|
par.setSfwc(1);
|
||||||
}
|
}
|
||||||
blSadJobService.updateById(par);
|
blSadJobService.updateById(par);
|
||||||
}
|
}
|
||||||
|
log.info("--------------完成赠送盛安豆定时任务--------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
//技师每天闲时配置
|
//技师每天闲时配置
|
||||||
@Scheduled(cron = "10 00 0 * * ?")
|
@Scheduled(cron = "10 00 0 * * ?")
|
||||||
public void setArtificerTime() {
|
public void setArtificerTime() {
|
||||||
|
log.info("--------------开始设置技师每天闲时配置--------------");
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
String startDate = DateUtils.format(calendar.getTime(),DateUtils.DATE_PATTERN);
|
String startDate = DateUtils.format(calendar.getTime(), DateUtils.DATE_PATTERN);
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, 3);
|
calendar.add(Calendar.DAY_OF_MONTH, 3);
|
||||||
String endDate = DateUtils.format(calendar.getTime(),DateUtils.DATE_PATTERN);
|
String endDate = DateUtils.format(calendar.getTime(), DateUtils.DATE_PATTERN);
|
||||||
QueryWrapper<ArtificerTimeIdel> queryWrapper = new QueryWrapper<ArtificerTimeIdel>();
|
QueryWrapper<ArtificerTimeIdel> queryWrapper = new QueryWrapper<ArtificerTimeIdel>();
|
||||||
queryWrapper.apply("id in ( select max(id) from artificer_time_idel b group by artificer_id )");
|
queryWrapper.apply("id in ( select max(id) from artificer_time_idel b group by artificer_id )");
|
||||||
List<ArtificerTimeIdel> artificerTimeIdelList = artificerTimeIdelDao.selectList(queryWrapper);
|
List<ArtificerTimeIdel> artificerTimeIdelList = artificerTimeIdelDao.selectList(queryWrapper);
|
||||||
for(int i=0;i<artificerTimeIdelList.size();i++){
|
for (int i = 0; i < artificerTimeIdelList.size(); i++) {
|
||||||
ArtificerTimeIdel ati = artificerTimeIdelList.get(i);
|
ArtificerTimeIdel ati = artificerTimeIdelList.get(i);
|
||||||
String startTime = ati.getStartTime();
|
String startTime = ati.getStartTime();
|
||||||
String endTime = ati.getEndTime();
|
String endTime = ati.getEndTime();
|
||||||
Long artificerId = ati.getArtificerId();
|
Long artificerId = ati.getArtificerId();
|
||||||
// Map<String,List> dateMap = getIdelMap(startDate+" "+startTime,endDate+" "+endTime);
|
// Map<String,List> dateMap = getIdelMap(startDate+" "+startTime,endDate+" "+endTime);
|
||||||
Map<String,List> dateMap = getIdelMap(startDate,startTime,endDate,endTime);
|
Map<String, List> dateMap = getIdelMap(startDate, startTime, endDate, endTime);
|
||||||
Map<String,List> busyMap = getBusyMap(dateMap);
|
Map<String, List> busyMap = getBusyMap(dateMap);
|
||||||
for (String key : busyMap.keySet()) {
|
for (String key : busyMap.keySet()) {
|
||||||
List<String> busyTimeList = busyMap.get(key);
|
List<String> busyTimeList = busyMap.get(key);
|
||||||
for(String time : busyTimeList){
|
for (String time : busyTimeList) {
|
||||||
Integer counts = artificerTimeDao.selectCount(new QueryWrapper<ArtificerTime>().eq("artificer_date", key).eq("artificer_id", artificerId).eq("artificer_time", time));
|
Integer counts = artificerTimeDao.selectCount(new QueryWrapper<ArtificerTime>().eq("artificer_date", key).eq("artificer_id", artificerId).eq("artificer_time", time));
|
||||||
if(counts==0){
|
if (counts == 0) {
|
||||||
ArtificerTime artificerTime=new ArtificerTime();
|
ArtificerTime artificerTime = new ArtificerTime();
|
||||||
artificerTime.setArtificerDate(key);
|
artificerTime.setArtificerDate(key);
|
||||||
artificerTime.setArtificerTime(time);
|
artificerTime.setArtificerTime(time);
|
||||||
artificerTime.setArtificerId(artificerId);
|
artificerTime.setArtificerId(artificerId);
|
||||||
|
@ -438,65 +447,66 @@ public class AllTaskServiceImpl implements AllTaskSercice {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.info("--------------完成设置技师每天闲时配置--------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
// private Map<String,List> getIdelMap(String startDateStr, String endDateStr){
|
// private Map<String,List> getIdelMap(String startDateStr, String endDateStr){
|
||||||
private Map<String,List> getIdelMap(String startDayStr,String startTimeStr,String endDayStr,String endTimeStr){
|
private Map<String, List> getIdelMap(String startDayStr, String startTimeStr, String endDayStr, String endTimeStr) {
|
||||||
Map<String,List> map = new HashMap();
|
Map<String, List> map = new HashMap();
|
||||||
Date startDate = DateUtils.stringToDate(startDayStr,"yyyy-MM-dd");
|
Date startDate = DateUtils.stringToDate(startDayStr, "yyyy-MM-dd");
|
||||||
Date endDate = DateUtils.stringToDate(endDayStr,"yyyy-MM-dd");
|
Date endDate = DateUtils.stringToDate(endDayStr, "yyyy-MM-dd");
|
||||||
Date startTime = DateUtils.stringToDate(startTimeStr,"HH:mm");
|
Date startTime = DateUtils.stringToDate(startTimeStr, "HH:mm");
|
||||||
Date endTime = DateUtils.stringToDate(endTimeStr,"HH:mm");
|
Date endTime = DateUtils.stringToDate(endTimeStr, "HH:mm");
|
||||||
Date currentDate = startDate;
|
Date currentDate = startDate;
|
||||||
while(currentDate.getTime()<=endDate.getTime()){
|
while (currentDate.getTime() <= endDate.getTime()) {
|
||||||
String day = DateUtils.format(currentDate,"yyyy-MM-dd");
|
String day = DateUtils.format(currentDate, "yyyy-MM-dd");
|
||||||
Date currentTime = startTime;
|
Date currentTime = startTime;
|
||||||
while(currentTime.getTime()<=endTime.getTime()){
|
while (currentTime.getTime() <= endTime.getTime()) {
|
||||||
String time = DateUtils.format(currentTime,"HH:mm");
|
String time = DateUtils.format(currentTime, "HH:mm");
|
||||||
if(map.get(day)!=null){
|
if (map.get(day) != null) {
|
||||||
List<String> timeList = map.get(day);
|
List<String> timeList = map.get(day);
|
||||||
timeList.add(time);
|
timeList.add(time);
|
||||||
}else{
|
} else {
|
||||||
List<String> timeList = new ArrayList<>();
|
List<String> timeList = new ArrayList<>();
|
||||||
timeList.add(time);
|
timeList.add(time);
|
||||||
map.put(day,timeList);
|
map.put(day, timeList);
|
||||||
}
|
}
|
||||||
currentTime = DateUtils.addDateMinutes(currentTime,30);
|
currentTime = DateUtils.addDateMinutes(currentTime, 30);
|
||||||
}
|
}
|
||||||
currentDate = DateUtils.addDateDays(currentDate,1);
|
currentDate = DateUtils.addDateDays(currentDate, 1);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String,List> getBusyMap(Map<String,List> dateMap){
|
private Map<String, List> getBusyMap(Map<String, List> dateMap) {
|
||||||
Map<String,List> map = new HashMap();
|
Map<String, List> map = new HashMap();
|
||||||
for (String key : dateMap.keySet()) {
|
for (String key : dateMap.keySet()) {
|
||||||
List<String> timeList = dateMap.get(key);
|
List<String> timeList = dateMap.get(key);
|
||||||
Map<String,String> allTimes = getTimeMap();
|
Map<String, String> allTimes = getTimeMap();
|
||||||
for(int i=0; i < timeList.size();i++){
|
for (int i = 0; i < timeList.size(); i++) {
|
||||||
String time = timeList.get(i);
|
String time = timeList.get(i);
|
||||||
if(allTimes.get(time)!=null){
|
if (allTimes.get(time) != null) {
|
||||||
allTimes.remove(time);
|
allTimes.remove(time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<String> keyList = allTimes.keySet().stream().collect(Collectors.toList());
|
List<String> keyList = allTimes.keySet().stream().collect(Collectors.toList());
|
||||||
Collections.sort(keyList);
|
Collections.sort(keyList);
|
||||||
map.put(key,keyList);
|
map.put(key, keyList);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map getTimeMap(){
|
private Map getTimeMap() {
|
||||||
Map<String,String> map = new HashMap();
|
Map<String, String> map = new HashMap();
|
||||||
for(int i=0;i<24;i++){
|
for (int i = 0; i < 24; i++) {
|
||||||
String s = "";
|
String s = "";
|
||||||
if(i<10){
|
if (i < 10) {
|
||||||
s = "0"+i+":";
|
s = "0" + i + ":";
|
||||||
}else{
|
} else {
|
||||||
s = i+":";
|
s = i + ":";
|
||||||
}
|
}
|
||||||
map.put(s+"00",s+"00");
|
map.put(s + "00", s + "00");
|
||||||
map.put(s+"30",s+"30");
|
map.put(s + "30", s + "30");
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,505 @@
|
||||||
|
//package com.sqx.modules.task.service.impl;
|
||||||
|
//
|
||||||
|
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
//import com.sqx.common.utils.DateUtils;
|
||||||
|
//import com.sqx.modules.app.entity.UserMoney;
|
||||||
|
//import com.sqx.modules.app.entity.UserSadDetails;
|
||||||
|
//import com.sqx.modules.app.service.UserMoneyService;
|
||||||
|
//import com.sqx.modules.app.service.UserSadDetailsService;
|
||||||
|
//import com.sqx.modules.artificer.dao.*;
|
||||||
|
//import com.sqx.modules.artificer.entity.*;
|
||||||
|
//import com.sqx.modules.bl.artificer.dao.ArtificerIntegralStatisticsDao;
|
||||||
|
//import com.sqx.modules.bl.artificer.dao.ArtificerPartitioningDetailsDao;
|
||||||
|
//import com.sqx.modules.bl.artificer.entity.ArtificerIntegralStatistics;
|
||||||
|
//import com.sqx.modules.bl.artificer.entity.ArtificerPartitioningDetails;
|
||||||
|
//import com.sqx.modules.bl.sadjob.entity.BlSadJob;
|
||||||
|
//import com.sqx.modules.bl.sadjob.service.BlSadJobService;
|
||||||
|
//import com.sqx.modules.bl.userZxsc.dao.BlUserZxscDao;
|
||||||
|
//import com.sqx.modules.bl.userZxsc.entity.BlUserZxsc;
|
||||||
|
//import com.sqx.modules.common.dao.CommonInfoDao;
|
||||||
|
//import com.sqx.modules.common.entity.CommonInfo;
|
||||||
|
//import com.sqx.modules.task.service.AllTaskSercice;
|
||||||
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
|
//import org.apache.commons.lang.StringUtils;
|
||||||
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
//import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
//import org.springframework.stereotype.Service;
|
||||||
|
//
|
||||||
|
//import java.math.BigDecimal;
|
||||||
|
//import java.text.ParseException;
|
||||||
|
//import java.text.SimpleDateFormat;
|
||||||
|
//import java.util.*;
|
||||||
|
//import java.util.stream.Collectors;
|
||||||
|
//
|
||||||
|
//@Service
|
||||||
|
//@Slf4j
|
||||||
|
//public class AllTaskServiceImpl_bk implements AllTaskSercice {
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private ArtificerDao artificerDao;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private ArtificerPartitioningDetailsDao artificerPartitioningDetailsDao;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private OrdersDao ordersDao;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private BlUserZxscDao blUserZxscDao;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// public CommonInfoDao commonInfoDao;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private UserRechargeDao userRechargeDao;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private BlArtificerZqhzDao blArtificerZqhzDao;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private BlSadJobService blSadJobService;
|
||||||
|
// @Autowired
|
||||||
|
// private UserSadDetailsService userSadDetailsService;
|
||||||
|
// @Autowired
|
||||||
|
// private UserMoneyService userMoneyService;
|
||||||
|
// @Autowired
|
||||||
|
// private ArtificerIntegralStatisticsDao artificerIntegralStatisticsDao;
|
||||||
|
// @Autowired
|
||||||
|
// private ArtificerTimeDao artificerTimeDao;
|
||||||
|
// @Autowired
|
||||||
|
// private ArtificerTimeIdelDao artificerTimeIdelDao;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 计算技师升级规则 每天半夜1点执行,预留12点到01点之间的计算间隔,用于触发其他计算逻辑
|
||||||
|
// * A0,A1,A2,A3,A4,A5等
|
||||||
|
// */
|
||||||
|
//// @Scheduled(cron = "0 * * * * ?")
|
||||||
|
// @Scheduled(cron = "0 00 04 * * ?")
|
||||||
|
// public void upgradeJishi() {
|
||||||
|
// System.out.println("------------计算技师升级规则-----------");
|
||||||
|
// Calendar calendar = Calendar.getInstance();
|
||||||
|
// //新手技师
|
||||||
|
// List<Artificer> xsList = artificerDao.getXsList();
|
||||||
|
// if(xsList.size()>0){
|
||||||
|
// QueryWrapper<ArtificerPartitioningDetails> sjgzQuery = new QueryWrapper<ArtificerPartitioningDetails>();
|
||||||
|
// sjgzQuery.ne("grade","新");
|
||||||
|
// sjgzQuery.orderByAsc("id");
|
||||||
|
// sjgzQuery.last("limit 1");
|
||||||
|
// ArtificerPartitioningDetails jsdj = artificerPartitioningDetailsDao.selectOne(sjgzQuery);
|
||||||
|
// for(Artificer artificer : xsList){
|
||||||
|
// String createTime = artificer.getCreateTime();
|
||||||
|
// Date date = DateUtils.stringToDate(createTime,DateUtils.DATE_TIME_PATTERN);
|
||||||
|
// date = DateUtils.addDateDays(date,7);
|
||||||
|
// Date current = calendar.getTime();
|
||||||
|
// if(current.getTime()>=date.getTime()){
|
||||||
|
// artificer.setGrade(jsdj.getGrade());
|
||||||
|
// QueryWrapper<BlArtificerZqhz> zqhzQuery = new QueryWrapper<BlArtificerZqhz>();
|
||||||
|
// sjgzQuery.eq("artificer_id",artificer.getArtificerId());
|
||||||
|
// sjgzQuery.orderByDesc("id");
|
||||||
|
// sjgzQuery.last("limit 1");
|
||||||
|
// BlArtificerZqhz blArtificerZqhz = blArtificerZqhzDao.selectOne(zqhzQuery);
|
||||||
|
// if(blArtificerZqhz!=null){
|
||||||
|
// if(blArtificerZqhz.getGrade()!=null&&!blArtificerZqhz.getGrade().equals("")){
|
||||||
|
// artificer.setGrade(blArtificerZqhz.getGrade());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// artificerDao.updateById(artificer);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //1.获取计算周期,从几号到几号例如1号-15号为一个周期,16号到31号第二个周期
|
||||||
|
// int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
|
||||||
|
// String startTime = "";
|
||||||
|
// String endTime = "";
|
||||||
|
// //获取执行时间
|
||||||
|
// if(dayOfMonth == 1){
|
||||||
|
// Calendar calendar4 = Calendar.getInstance();
|
||||||
|
// calendar4.set(Calendar.DAY_OF_MONTH, 1);
|
||||||
|
// calendar4.add(Calendar.DAY_OF_MONTH, -1);
|
||||||
|
// int lastDayOfMonth = calendar4.get(Calendar.DAY_OF_MONTH);
|
||||||
|
// Calendar calendar2 = Calendar.getInstance();
|
||||||
|
// calendar2.add(Calendar.MONTH, -1); // 获取上个月
|
||||||
|
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
|
||||||
|
// String lastMonth = format.format(calendar2.getTime());
|
||||||
|
// startTime = lastMonth+"-16 00:00:00";
|
||||||
|
// endTime = lastMonth+"-"+lastDayOfMonth+" 23:59:59";
|
||||||
|
// }else if(dayOfMonth == 16){
|
||||||
|
// Calendar calendar4 = Calendar.getInstance();
|
||||||
|
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
|
||||||
|
// String lastMonth = format.format(calendar4.getTime());
|
||||||
|
// startTime = lastMonth+"-01 00:00:00";
|
||||||
|
// endTime = lastMonth+"-15 23:59:59";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//// startTime = "2024-06-21 00:00:00";
|
||||||
|
//// endTime = "2024-06-30 23:59:59";
|
||||||
|
// //不为空则继续执行,否则不到时间不计算升级规则
|
||||||
|
// if(StringUtils.isNotEmpty(startTime)){
|
||||||
|
// //2.获取全部参与积分规则的技师
|
||||||
|
// List<Artificer> jslist = artificerDao.getYxjsList();
|
||||||
|
// //3.查询升级规则配置表
|
||||||
|
// QueryWrapper<ArtificerPartitioningDetails> sjgzQuery = new QueryWrapper<ArtificerPartitioningDetails>();
|
||||||
|
// sjgzQuery.ne("grade","新");
|
||||||
|
// sjgzQuery.orderByDesc("outstanding_achievement","duration_online");
|
||||||
|
// List<ArtificerPartitioningDetails> sjgzAllList = artificerPartitioningDetailsDao.selectList(sjgzQuery);
|
||||||
|
// //4.根据技师的服务类型查找对应的配置规则,
|
||||||
|
// for (Artificer jsPar : jslist) {
|
||||||
|
// //获取技师是否参与积分规则,如果参与积分规则则继续执行,否则不变分成比例
|
||||||
|
// //业绩、积分、收入
|
||||||
|
// ArtificerIntegralStatistics artificerIntegralStatistics = artificerIntegralStatisticsDao.getIntegralStatistics(jsPar.getArtificerId(),startTime,endTime,null);
|
||||||
|
// BigDecimal outstandingAchievement = BigDecimal.ZERO;
|
||||||
|
// BigDecimal integral = BigDecimal.ZERO;
|
||||||
|
// BigDecimal income = BigDecimal.ZERO;
|
||||||
|
// if(artificerIntegralStatistics!=null){
|
||||||
|
// if(artificerIntegralStatistics.getAchievement()!=null){
|
||||||
|
// outstandingAchievement = artificerIntegralStatistics.getAchievement();
|
||||||
|
// }
|
||||||
|
// if(artificerIntegralStatistics.getIntegral()!=null){
|
||||||
|
// integral = artificerIntegralStatistics.getIntegral();
|
||||||
|
// }
|
||||||
|
// if(artificerIntegralStatistics.getIncome()!=null){
|
||||||
|
// income = artificerIntegralStatistics.getIncome();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// //在线时长
|
||||||
|
// ArtificerIntegralStatistics zxscStatistics = artificerIntegralStatisticsDao.getIntegralStatistics(jsPar.getArtificerId(),startTime,endTime,1);
|
||||||
|
// BigDecimal zxscjf = BigDecimal.ZERO;
|
||||||
|
// if(zxscStatistics!=null){
|
||||||
|
// zxscjf = zxscStatistics.getIntegral();
|
||||||
|
// }
|
||||||
|
// //多少分钟等1积分
|
||||||
|
// CommonInfo commonInfo = commonInfoDao.findOne(100000);
|
||||||
|
// String value = commonInfo.getValue();
|
||||||
|
// BigDecimal zxcs = zxscjf.multiply(new BigDecimal(value)).divide(new BigDecimal("60"), BigDecimal.ROUND_DOWN);//在线时长(小时)
|
||||||
|
//
|
||||||
|
// String jsdj = "";//等级
|
||||||
|
// BigDecimal rate = BigDecimal.valueOf(0);
|
||||||
|
// for (ArtificerPartitioningDetails sjgzPar : sjgzAllList){
|
||||||
|
// //当技师的服务类型=升级规则的服务类型,才可以添加到升级规则里去
|
||||||
|
// //最低业绩
|
||||||
|
// BigDecimal zddjPar = sjgzPar.getOutstandingAchievement();
|
||||||
|
// //积分
|
||||||
|
// BigDecimal czjfPar = new BigDecimal(sjgzPar.getIntegral());
|
||||||
|
// //在线时长
|
||||||
|
// BigDecimal zxscPar = new BigDecimal(sjgzPar.getDurationOnline());
|
||||||
|
//
|
||||||
|
// if(outstandingAchievement.compareTo(zddjPar)>=0&&integral.compareTo(czjfPar)>=0&&zxcs.compareTo(zxscPar)>=0){
|
||||||
|
// jsdj = sjgzPar.getGrade();
|
||||||
|
// rate = BigDecimal.valueOf(Double.parseDouble(sjgzPar.getProportionalSharing()));
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// //如果都不符合,则给最低等级(保底)
|
||||||
|
// if(StringUtils.isEmpty(jsdj)){
|
||||||
|
// QueryWrapper<ArtificerPartitioningDetails> sjgzQuery1 = new QueryWrapper<ArtificerPartitioningDetails>();
|
||||||
|
// sjgzQuery.ne("grade","新");
|
||||||
|
// sjgzQuery.orderByAsc("id");
|
||||||
|
// sjgzQuery.last("limit 1");
|
||||||
|
// List<ArtificerPartitioningDetails> zddjgz = artificerPartitioningDetailsDao.selectList(sjgzQuery1);
|
||||||
|
// if(zddjgz!=null && zddjgz.size()>0){
|
||||||
|
// jsdj = zddjgz.get(0).getGrade();
|
||||||
|
// rate = new BigDecimal(zddjgz.get(0).getProportionalSharing());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if(StringUtils.isEmpty(jsdj)){
|
||||||
|
// jsdj = "T0";
|
||||||
|
// rate = BigDecimal.valueOf(0.5);
|
||||||
|
// }
|
||||||
|
// if(StringUtils.isNotEmpty(jsdj)){
|
||||||
|
// if(jsPar.getGrade().equals("新")){
|
||||||
|
// if(rate.compareTo(jsPar.getRate())>=0){
|
||||||
|
// Artificer jsUp = new Artificer();
|
||||||
|
// jsUp.setRate(rate);
|
||||||
|
// jsUp.setGrade(jsdj);
|
||||||
|
// jsUp.setArtificerId(jsPar.getArtificerId());
|
||||||
|
// artificerDao.updateById(jsUp);
|
||||||
|
// }
|
||||||
|
// }else{
|
||||||
|
// Artificer jsUp = new Artificer();
|
||||||
|
// jsUp.setRate(rate);
|
||||||
|
// jsUp.setGrade(jsdj);
|
||||||
|
// jsUp.setArtificerId(jsPar.getArtificerId());
|
||||||
|
// artificerDao.updateById(jsUp);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //技师汇总逻辑
|
||||||
|
// QueryWrapper<BlArtificerZqhz> blArtificerZqhzQueryWrapper = new QueryWrapper<>();
|
||||||
|
// blArtificerZqhzQueryWrapper.eq("artificer_id",jsPar.getArtificerId());
|
||||||
|
// blArtificerZqhzQueryWrapper.ge("start_time",startTime);
|
||||||
|
// blArtificerZqhzQueryWrapper.le("end_time",endTime);
|
||||||
|
// blArtificerZqhzDao.delete(blArtificerZqhzQueryWrapper);
|
||||||
|
//
|
||||||
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
// BlArtificerZqhz blArtificerZqhz = new BlArtificerZqhz();
|
||||||
|
// blArtificerZqhz.setArtificerId(jsPar.getArtificerId());
|
||||||
|
// try {
|
||||||
|
// blArtificerZqhz.setStartTime(sdf.parse(startTime));
|
||||||
|
// blArtificerZqhz.setEndTime(sdf.parse(endTime));
|
||||||
|
// } catch (ParseException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// blArtificerZqhz.setXsje(income+""); //销售金额
|
||||||
|
// blArtificerZqhz.setYj(outstandingAchievement+""); //业绩
|
||||||
|
// blArtificerZqhz.setZxsc(zxcs+"");//在线时长
|
||||||
|
// blArtificerZqhz.setJf(integral+"");//积分
|
||||||
|
// blArtificerZqhz.setGrade(jsdj);//等级
|
||||||
|
// blArtificerZqhzDao.insert(blArtificerZqhz);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 计算技师在线时长,每10分钟计算一积分
|
||||||
|
// */
|
||||||
|
// @Scheduled(cron = "0 * * * * ?")
|
||||||
|
// public void upJishiZxsc() throws ParseException {
|
||||||
|
// System.out.println("----------------计算技师在线时长,每10分钟计算一积分-------------");
|
||||||
|
// CommonInfo commonInfo = commonInfoDao.findOne(100000);
|
||||||
|
// String minute = commonInfo.getValue();//多少分钟等于1积分
|
||||||
|
//
|
||||||
|
// Artificer artificer = new Artificer();
|
||||||
|
// artificer.setStatus(1);
|
||||||
|
// List<Artificer> artificerList = artificerDao.selectInlineList(artificer);
|
||||||
|
// Date now = new Date();
|
||||||
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
// for(Artificer par:artificerList){
|
||||||
|
// //取最新的一回的获得积分时间
|
||||||
|
// QueryWrapper<BlUserZxsc> queryWrapper = new QueryWrapper<>();
|
||||||
|
// queryWrapper.eq("artificer_id",par.getArtificerId());
|
||||||
|
// queryWrapper.orderByDesc("create_time");
|
||||||
|
// queryWrapper.last("limit 1");
|
||||||
|
// BlUserZxsc blUserZxsc = blUserZxscDao.selectOne(queryWrapper);
|
||||||
|
// if(blUserZxsc == null){
|
||||||
|
// BigDecimal recharge = new BigDecimal(1);
|
||||||
|
// BlUserZxsc newBlUserZxsc = new BlUserZxsc();
|
||||||
|
// newBlUserZxsc.setArtificerId(par.getArtificerId());
|
||||||
|
// newBlUserZxsc.setUserRecharge(recharge);
|
||||||
|
// newBlUserZxsc.setCreateTime(sdf.format(new Date()));
|
||||||
|
// blUserZxscDao.insert(newBlUserZxsc);
|
||||||
|
// }else{
|
||||||
|
// String createTime = blUserZxsc.getCreateTime();
|
||||||
|
// //上一回时间加十分钟
|
||||||
|
// Calendar calendar = Calendar.getInstance();
|
||||||
|
// calendar.setTime(sdf.parse(createTime));
|
||||||
|
// calendar.add(Calendar.MINUTE, Integer.parseInt(minute));
|
||||||
|
// Date nextDate = calendar.getTime();
|
||||||
|
// if (now.getTime()>=nextDate.getTime()) {//nowTime < newTime
|
||||||
|
// BigDecimal recharge = new BigDecimal(1);
|
||||||
|
// BlUserZxsc newBlUserZxsc = new BlUserZxsc();
|
||||||
|
// newBlUserZxsc.setArtificerId(par.getArtificerId());
|
||||||
|
// newBlUserZxsc.setUserRecharge(recharge);
|
||||||
|
// newBlUserZxsc.setCreateTime(sdf.format(new Date()));
|
||||||
|
// blUserZxscDao.insert(newBlUserZxsc);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 积分汇总 t+1进行汇总
|
||||||
|
// */
|
||||||
|
// @Scheduled(cron = "0 0 0 * * ?")
|
||||||
|
// public void tongjiJishiGrade() {
|
||||||
|
// System.out.println("----------------每日积分汇总 定时任务-------------");
|
||||||
|
// //当前时间减一天
|
||||||
|
// Calendar calendar = Calendar.getInstance();
|
||||||
|
// calendar.add(Calendar.DAY_OF_YEAR, -1);//上一天
|
||||||
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
// SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
// String date = sdf.format(calendar.getTime());
|
||||||
|
// BlUserZxsc blUserZxscParam = new BlUserZxsc();
|
||||||
|
// blUserZxscParam.setCreateTime(date);
|
||||||
|
// List<BlUserZxsc> blUserZxsc = blUserZxscDao.selectGrouplist(blUserZxscParam);
|
||||||
|
// String dateStr = sdf2.format(calendar.getTime());
|
||||||
|
// for(BlUserZxsc blUserZxscPar:blUserZxsc){
|
||||||
|
//
|
||||||
|
// QueryWrapper<UserRecharge> delWrapper = new QueryWrapper<UserRecharge>();
|
||||||
|
// delWrapper.eq("artificer_id",blUserZxscPar.getArtificerId());
|
||||||
|
// delWrapper.eq("type",1);
|
||||||
|
// delWrapper.ge("create_time",date);
|
||||||
|
// delWrapper.le("create_time",date+" 23:59:59");
|
||||||
|
// userRechargeDao.delete(delWrapper);
|
||||||
|
//
|
||||||
|
// UserRecharge userRecharge = new UserRecharge();
|
||||||
|
// userRecharge.setArtificerId(blUserZxscPar.getArtificerId());
|
||||||
|
// userRecharge.setUserRecharge(blUserZxscPar.getUserRecharge());
|
||||||
|
// userRecharge.setType("1");
|
||||||
|
// userRecharge.setUserId(null);
|
||||||
|
// userRecharge.setCreateTime(dateStr);
|
||||||
|
// userRechargeDao.insert(userRecharge);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 业绩积分汇总 t+1 8时进行汇总
|
||||||
|
// */
|
||||||
|
// @Scheduled(cron = "0 0 1 * * ?")
|
||||||
|
// public void tongjiIntegral() {
|
||||||
|
// System.out.println("----------------每日积业绩及分汇总 定时任务-------------");
|
||||||
|
// //当前时间减一天
|
||||||
|
// Calendar calendar = Calendar.getInstance();
|
||||||
|
// calendar.add(Calendar.DAY_OF_YEAR, -1);//上一天
|
||||||
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
// SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
// String date = sdf.format(calendar.getTime());
|
||||||
|
// BlUserZxsc blUserZxscParam = new BlUserZxsc();
|
||||||
|
// blUserZxscParam.setCreateTime(date);
|
||||||
|
// //获取在线积分
|
||||||
|
// List<BlUserZxsc> blUserZxsc = blUserZxscDao.selectGrouplist(blUserZxscParam);
|
||||||
|
// for(BlUserZxsc blUserZxscPar:blUserZxsc){
|
||||||
|
// QueryWrapper<ArtificerIntegralStatistics> delWrapper = new QueryWrapper<ArtificerIntegralStatistics>();
|
||||||
|
// delWrapper.eq("artificer_id",blUserZxscPar.getArtificerId());
|
||||||
|
// delWrapper.eq("classify",1);
|
||||||
|
// delWrapper.ge("create_time",date);
|
||||||
|
// delWrapper.le("create_time",date+" 23:59:59");
|
||||||
|
// artificerIntegralStatisticsDao.delete(delWrapper);
|
||||||
|
//
|
||||||
|
// Artificer artificer = artificerDao.selectById(blUserZxscPar.getArtificerId());
|
||||||
|
// ArtificerIntegralStatistics artificerIntegralStatistics = new ArtificerIntegralStatistics();
|
||||||
|
// artificerIntegralStatistics.setArtificerId(blUserZxscPar.getArtificerId());
|
||||||
|
// artificerIntegralStatistics.setArtificerName(artificer.getArtificerName());
|
||||||
|
// artificerIntegralStatistics.setClassify(1);
|
||||||
|
// artificerIntegralStatistics.setType(1);
|
||||||
|
// artificerIntegralStatistics.setIntegral(blUserZxscPar.getUserRecharge());
|
||||||
|
// artificerIntegralStatistics.setCreateTime(date+" 23:59:59");
|
||||||
|
// artificerIntegralStatisticsDao.insert(artificerIntegralStatistics);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //赠送盛安豆定时任务
|
||||||
|
// @Scheduled(cron = "0 10 0 * * ?")
|
||||||
|
// public void updateSadJob() {
|
||||||
|
// QueryWrapper<BlSadJob> query = new QueryWrapper<>();
|
||||||
|
// query.eq("sfwc",0);
|
||||||
|
// List<BlSadJob> list = blSadJobService.list(query);
|
||||||
|
// for(BlSadJob par : list){
|
||||||
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
// String date=sdf.format(new Date());
|
||||||
|
// userMoneyService.updateSad(1,par.getUserId(),par.getDayMoney());
|
||||||
|
// UserSadDetails userMoneyDetails=new UserSadDetails();
|
||||||
|
// //查询用户当前余额
|
||||||
|
// UserMoney userNowMoney = userMoneyService.selectUserMoneyByUserId(par.getUserId());
|
||||||
|
// //插入余额
|
||||||
|
// userMoneyDetails.setBalance(userNowMoney.getSad());
|
||||||
|
// //插入操作类型为已操作用户余额
|
||||||
|
// userMoneyDetails.setManipulateType(2);
|
||||||
|
// userMoneyDetails.setUserId(par.getUserId());
|
||||||
|
// userMoneyDetails.setTitle("[充值赠送]标题:充值");
|
||||||
|
// userMoneyDetails.setContent("获得盛安豆:"+par.getDayMoney());
|
||||||
|
// userMoneyDetails.setType(1);
|
||||||
|
// userMoneyDetails.setMoney(userNowMoney.getSad());
|
||||||
|
// userMoneyDetails.setCreateTime(date);
|
||||||
|
// userMoneyDetails.setBlRole(2);
|
||||||
|
// userMoneyDetails.setBlFlag(1);
|
||||||
|
// userSadDetailsService.insert(userMoneyDetails);
|
||||||
|
// int day = par.getDayNum()+1;
|
||||||
|
// par.setDayNum(day);
|
||||||
|
// if(day == par.getDaySumNum()){
|
||||||
|
// par.setSfwc(1);
|
||||||
|
// }
|
||||||
|
// blSadJobService.updateById(par);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //技师每天闲时配置
|
||||||
|
// @Scheduled(cron = "10 00 0 * * ?")
|
||||||
|
// public void setArtificerTime() {
|
||||||
|
// Calendar calendar = Calendar.getInstance();
|
||||||
|
// String startDate = DateUtils.format(calendar.getTime(),DateUtils.DATE_PATTERN);
|
||||||
|
// calendar.add(Calendar.DAY_OF_MONTH, 3);
|
||||||
|
// String endDate = DateUtils.format(calendar.getTime(),DateUtils.DATE_PATTERN);
|
||||||
|
// QueryWrapper<ArtificerTimeIdel> queryWrapper = new QueryWrapper<ArtificerTimeIdel>();
|
||||||
|
// queryWrapper.apply("id in ( select max(id) from artificer_time_idel b group by artificer_id )");
|
||||||
|
// List<ArtificerTimeIdel> artificerTimeIdelList = artificerTimeIdelDao.selectList(queryWrapper);
|
||||||
|
// for(int i=0;i<artificerTimeIdelList.size();i++){
|
||||||
|
// ArtificerTimeIdel ati = artificerTimeIdelList.get(i);
|
||||||
|
// String startTime = ati.getStartTime();
|
||||||
|
// String endTime = ati.getEndTime();
|
||||||
|
// Long artificerId = ati.getArtificerId();
|
||||||
|
//// Map<String,List> dateMap = getIdelMap(startDate+" "+startTime,endDate+" "+endTime);
|
||||||
|
// Map<String,List> dateMap = getIdelMap(startDate,startTime,endDate,endTime);
|
||||||
|
// Map<String,List> busyMap = getBusyMap(dateMap);
|
||||||
|
// for (String key : busyMap.keySet()) {
|
||||||
|
// List<String> busyTimeList = busyMap.get(key);
|
||||||
|
// for(String time : busyTimeList){
|
||||||
|
// Integer counts = artificerTimeDao.selectCount(new QueryWrapper<ArtificerTime>().eq("artificer_date", key).eq("artificer_id", artificerId).eq("artificer_time", time));
|
||||||
|
// if(counts==0){
|
||||||
|
// ArtificerTime artificerTime=new ArtificerTime();
|
||||||
|
// artificerTime.setArtificerDate(key);
|
||||||
|
// artificerTime.setArtificerTime(time);
|
||||||
|
// artificerTime.setArtificerId(artificerId);
|
||||||
|
// artificerTime.setClassify(2);
|
||||||
|
// artificerTime.setCreateTime(DateUtils.format(new Date()));
|
||||||
|
// artificerTimeDao.insert(artificerTime);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//// private Map<String,List> getIdelMap(String startDateStr, String endDateStr){
|
||||||
|
// private Map<String,List> getIdelMap(String startDayStr,String startTimeStr,String endDayStr,String endTimeStr){
|
||||||
|
// Map<String,List> map = new HashMap();
|
||||||
|
// Date startDate = DateUtils.stringToDate(startDayStr,"yyyy-MM-dd");
|
||||||
|
// Date endDate = DateUtils.stringToDate(endDayStr,"yyyy-MM-dd");
|
||||||
|
// Date startTime = DateUtils.stringToDate(startTimeStr,"HH:mm");
|
||||||
|
// Date endTime = DateUtils.stringToDate(endTimeStr,"HH:mm");
|
||||||
|
// Date currentDate = startDate;
|
||||||
|
// while(currentDate.getTime()<=endDate.getTime()){
|
||||||
|
// String day = DateUtils.format(currentDate,"yyyy-MM-dd");
|
||||||
|
// Date currentTime = startTime;
|
||||||
|
// while(currentTime.getTime()<=endTime.getTime()){
|
||||||
|
// String time = DateUtils.format(currentTime,"HH:mm");
|
||||||
|
// if(map.get(day)!=null){
|
||||||
|
// List<String> timeList = map.get(day);
|
||||||
|
// timeList.add(time);
|
||||||
|
// }else{
|
||||||
|
// List<String> timeList = new ArrayList<>();
|
||||||
|
// timeList.add(time);
|
||||||
|
// map.put(day,timeList);
|
||||||
|
// }
|
||||||
|
// currentTime = DateUtils.addDateMinutes(currentTime,30);
|
||||||
|
// }
|
||||||
|
// currentDate = DateUtils.addDateDays(currentDate,1);
|
||||||
|
// }
|
||||||
|
// return map;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private Map<String,List> getBusyMap(Map<String,List> dateMap){
|
||||||
|
// Map<String,List> map = new HashMap();
|
||||||
|
// for (String key : dateMap.keySet()) {
|
||||||
|
// List<String> timeList = dateMap.get(key);
|
||||||
|
// Map<String,String> allTimes = getTimeMap();
|
||||||
|
// for(int i=0; i < timeList.size();i++){
|
||||||
|
// String time = timeList.get(i);
|
||||||
|
// if(allTimes.get(time)!=null){
|
||||||
|
// allTimes.remove(time);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// List<String> keyList = allTimes.keySet().stream().collect(Collectors.toList());
|
||||||
|
// Collections.sort(keyList);
|
||||||
|
// map.put(key,keyList);
|
||||||
|
// }
|
||||||
|
// return map;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private Map getTimeMap(){
|
||||||
|
// Map<String,String> map = new HashMap();
|
||||||
|
// for(int i=0;i<24;i++){
|
||||||
|
// String s = "";
|
||||||
|
// if(i<10){
|
||||||
|
// s = "0"+i+":";
|
||||||
|
// }else{
|
||||||
|
// s = i+":";
|
||||||
|
// }
|
||||||
|
// map.put(s+"00",s+"00");
|
||||||
|
// map.put(s+"30",s+"30");
|
||||||
|
// }
|
||||||
|
// return map;
|
||||||
|
// }
|
||||||
|
//}
|
|
@ -36,6 +36,11 @@ spring:
|
||||||
matching-strategy: ant_path_matcher
|
matching-strategy: ant_path_matcher
|
||||||
# resources:
|
# resources:
|
||||||
# add-mappings: false
|
# add-mappings: false
|
||||||
|
jpa:
|
||||||
|
show-sql: true
|
||||||
|
properties:
|
||||||
|
hibernate:
|
||||||
|
format_sql: true
|
||||||
|
|
||||||
|
|
||||||
#mybatis
|
#mybatis
|
||||||
|
|
|
@ -474,6 +474,12 @@
|
||||||
order by t.create_time,t.type
|
order by t.create_time,t.type
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="queryInServiceCount" resultType="java.lang.Integer">
|
||||||
|
select count(distinct artificer_id)
|
||||||
|
from orders
|
||||||
|
where status = 6
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertJfDetail">
|
<insert id="insertJfDetail">
|
||||||
insert into bl_artificer_integral_statistics(
|
insert into bl_artificer_integral_statistics(
|
||||||
artificer_id,
|
artificer_id,
|
||||||
|
|
|
@ -2125,5 +2125,8 @@
|
||||||
)
|
)
|
||||||
and o.status in (3,5)
|
and o.status in (3,5)
|
||||||
</select>
|
</select>
|
||||||
|
<select id="gztddList" resultType="com.sqx.modules.artificer.entity.Orders">
|
||||||
|
select (case when status = 1 then '待支付' when status = 2 then '待服务' when status = 3 then '待评论' when status = 5 then '已完成' when status = 6 then '进行中' when status = 7 then '技师出发' when status = 8 then '技师到达' when status = 9 then '待接单' end) ztName,count(orders_id) as cs from orders where status in (1,2,3,5,6,7,8,9) group by status
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.sqx.modules.bl.commission.qds.dao.QdsCodeRecordDao">
|
||||||
|
|
||||||
|
|
||||||
|
<select id="queryScanCodeRecord" resultType="java.lang.String">
|
||||||
|
select code from bl_qds_code_record where user_id = #{userId} AND create_time >= NOW() - INTERVAL 1 DAY limit 1
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -3,50 +3,191 @@
|
||||||
|
|
||||||
<mapper namespace="com.sqx.modules.bl.commission.qds.dao.QdsDataDao">
|
<mapper namespace="com.sqx.modules.bl.commission.qds.dao.QdsDataDao">
|
||||||
|
|
||||||
|
<!-- <select id="findPage" resultType="com.sqx.modules.bl.commission.qds.entity.QdsData">-->
|
||||||
|
<!-- select bqc.id,bqc.name as qdmName,bqc.code as qdsCode,bqc.lm,y.user_name as userName,x.name as qdsName,bqc.rate,-->
|
||||||
|
<!-- bqc.start_date as startTime,bqc.end_date as endTime,bqc.create_time as createTime,-->
|
||||||
|
<!-- ifnull((select count(*) from bl_qds_code_record bqcr where bqcr.code = bqc.code and is_new = 'Y'),0) as xyhsmsl,-->
|
||||||
|
<!-- ifnull((select count(*) from bl_qds_code_record bqcr where bqcr.code = bqc.code and is_new = 'N'),0) as lyhsmsl,-->
|
||||||
|
<!-- ifnull(t1.ordersCount,0) as ordersCount,-->
|
||||||
|
<!-- ifnull(t3.money,0) as money-->
|
||||||
|
<!-- from bl_qds_code bqc-->
|
||||||
|
<!-- inner join bl_qds_apply x on bqc.user_id = x.user_id and x.status = 1-->
|
||||||
|
<!-- inner join tb_user y on x.user_id = y.user_id-->
|
||||||
|
<!-- left join (-->
|
||||||
|
<!-- select count(*) as ordersCount, aa.user_id, bb.bl_qds_code-->
|
||||||
|
<!-- from (-->
|
||||||
|
<!-- select o1.orders_id,o1.user_id-->
|
||||||
|
<!-- from orders o1-->
|
||||||
|
<!-- left join orders o2 on o1.old_orders_id = o2.orders_id and o2.status != 4-->
|
||||||
|
<!-- left join orders o3 on o2.old_orders_id = o3.orders_id and o3.status != 4-->
|
||||||
|
<!-- where o1.old_orders_id is not null-->
|
||||||
|
<!-- and o1.status in (3,5)-->
|
||||||
|
<!-- union all-->
|
||||||
|
<!-- select o1.orders_id,o1.user_id-->
|
||||||
|
<!-- from orders o1-->
|
||||||
|
<!-- where o1.parent_id = 0-->
|
||||||
|
<!-- and o1.old_orders_id is null-->
|
||||||
|
<!-- and o1.orders_id not in (-->
|
||||||
|
<!-- select orders_id from orders-->
|
||||||
|
<!-- where old_orders_id is not null-->
|
||||||
|
<!-- and status != 4-->
|
||||||
|
<!-- )-->
|
||||||
|
<!-- and o1.orders_id not in (-->
|
||||||
|
<!-- select old_orders_id from orders-->
|
||||||
|
<!-- where old_orders_id is not null-->
|
||||||
|
<!-- and status != 4-->
|
||||||
|
<!-- )-->
|
||||||
|
<!-- and o1.status in (3,5)-->
|
||||||
|
<!-- ) aa inner join tb_user bb on aa.user_id = bb.user_id-->
|
||||||
|
<!-- group by aa.user_id, bb.bl_qds_code-->
|
||||||
|
<!-- ) t1 on t1.bl_qds_code = bqc.code-->
|
||||||
|
<!-- left join (-->
|
||||||
|
<!-- select sum(ifnull(qds_code_money,0)) money,user_id-->
|
||||||
|
<!-- from orders-->
|
||||||
|
<!-- where status in (3,5,15)-->
|
||||||
|
<!-- group by user_id-->
|
||||||
|
<!-- ) t3 on t3.user_id = x.user_id-->
|
||||||
|
<!-- where x.status= 1-->
|
||||||
|
<!-- <if test="params.qdmName!=null and params.qdmName!=''">-->
|
||||||
|
<!-- and bqc.name like concat('%',#{params.qdmName},'%')-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- <if test="params.qdsCode!=null and params.qdsCode!=''">-->
|
||||||
|
<!-- and bqc.code like concat('%',#{params.qdsCode},'%')-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- <if test="params.qdsName!=null and params.qdsName!=''">-->
|
||||||
|
<!-- and x.name like concat('%',#{params.qdsName},'%')-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- <if test="params.lm!=null and params.lm!=''">-->
|
||||||
|
<!-- and bqc.lm = #{params.lm}-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- order by x.id desc-->
|
||||||
|
<!-- </select>-->
|
||||||
|
|
||||||
<select id="findPage" resultType="com.sqx.modules.bl.commission.qds.entity.QdsData">
|
<select id="findPage" resultType="com.sqx.modules.bl.commission.qds.entity.QdsData">
|
||||||
select bqc.id,bqc.name as qdmName,bqc.code as qdsCode,bqc.lm,y.user_name as userName,x.name as qdsName,bqc.rate,
|
SELECT
|
||||||
bqc.start_date as startTime,bqc.end_date as endTime,bqc.create_time as createTime,
|
nnn.id,
|
||||||
ifnull((select count(*) from tb_user ac where ac.bl_qds_code = bqc.code and ifnull(bl_is_qds,0) = 0),0) as smCount,
|
nnn.qdmName,
|
||||||
ifnull(t1.ordersCount,0) as ordersCount,
|
nnn.qdsCode,
|
||||||
ifnull(t3.money,0) as money
|
nnn.lm,
|
||||||
from bl_qds_code bqc
|
nnn.userName,
|
||||||
inner join bl_qds_apply x on bqc.user_id = x.user_id and x.status = 1
|
nnn.qdsName,
|
||||||
inner join tb_user y on x.user_id = y.user_id
|
nnn.rate,
|
||||||
left join (
|
nnn.startTime,
|
||||||
select count(*) as ordersCount, aa.user_id, bb.bl_qds_code
|
nnn.endTime,
|
||||||
from (
|
nnn.createTime,
|
||||||
select o1.orders_id,o1.user_id
|
nnn.ordersCount,
|
||||||
from orders o1
|
nnn.money,
|
||||||
left join orders o2 on o1.old_orders_id = o2.orders_id and o2.status != 4
|
nnn.xyhsmsl,
|
||||||
left join orders o3 on o2.old_orders_id = o3.orders_id and o3.status != 4
|
nnn.lyhsmsl,
|
||||||
where o1.old_orders_id is not null
|
nnn.yxzcpts,
|
||||||
and o1.status in (3,5)
|
nnn.qdsfy,
|
||||||
union all
|
nnnttm.money zje
|
||||||
select o1.orders_id,o1.user_id
|
FROM
|
||||||
from orders o1
|
(
|
||||||
where o1.parent_id = 0
|
SELECT
|
||||||
and o1.old_orders_id is null
|
nnoq.id,
|
||||||
and o1.orders_id not in (
|
nnoq.qdmName,
|
||||||
select orders_id from orders
|
nnoq.qdsCode,
|
||||||
where old_orders_id is not null
|
nnoq.lm,
|
||||||
and status != 4
|
nnoq.userName,
|
||||||
)
|
nnoq.qdsName,
|
||||||
and o1.orders_id not in (
|
nnoq.rate,
|
||||||
select old_orders_id from orders
|
nnoq.startTime,
|
||||||
where old_orders_id is not null
|
nnoq.endTime,
|
||||||
and status != 4
|
nnoq.createTime,
|
||||||
)
|
nnoq.ordersCount,
|
||||||
and o1.status in (3,5)
|
nnoq.money,
|
||||||
) aa inner join tb_user bb on aa.user_id = bb.user_id
|
nnoq.xyhsmsl,
|
||||||
group by aa.user_id, bb.bl_qds_code
|
nnoq.lyhsmsl,
|
||||||
) t1 on t1.bl_qds_code = bqc.code
|
nnoq.yxzcpts,
|
||||||
left join (
|
sum( nnor.qds_code_money ) qdsfy
|
||||||
select sum(ifnull(qds_code_money,0)) money,user_id
|
FROM
|
||||||
from orders
|
(
|
||||||
where status in (3,5,15)
|
SELECT
|
||||||
group by user_id
|
oq.id,
|
||||||
) t3 on t3.user_id = x.user_id
|
oq.qdmName,
|
||||||
where x.status= 1
|
oq.qdsCode,
|
||||||
|
oq.lm,
|
||||||
|
oq.userName,
|
||||||
|
oq.qdsName,
|
||||||
|
oq.rate,
|
||||||
|
oq.startTime,
|
||||||
|
oq.endTime,
|
||||||
|
oq.createTime,
|
||||||
|
oq.ordersCount,
|
||||||
|
oq.money,
|
||||||
|
COUNT( CASE WHEN nbqcr.is_new = 'Y' THEN nbqcr.CODE END ) AS xyhsmsl,
|
||||||
|
COUNT( CASE WHEN nbqcr.is_new = 'N' THEN nbqcr.CODE END ) AS lyhsmsl,
|
||||||
|
count( DISTINCT ntu.user_id ) yxzcpts
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
bqc.id,
|
||||||
|
bqc.NAME AS qdmName,
|
||||||
|
bqc.CODE AS qdsCode,
|
||||||
|
bqc.lm,
|
||||||
|
y.user_name AS userName,
|
||||||
|
x.NAME AS qdsName,
|
||||||
|
bqc.rate,
|
||||||
|
bqc.start_date AS startTime,
|
||||||
|
bqc.end_date AS endTime,
|
||||||
|
bqc.create_time AS createTime,
|
||||||
|
ifnull( t1.ordersCount, 0 ) AS ordersCount,
|
||||||
|
ifnull( t3.money, 0 ) AS money
|
||||||
|
FROM
|
||||||
|
bl_qds_code bqc
|
||||||
|
INNER JOIN bl_qds_apply x ON bqc.user_id = x.user_id
|
||||||
|
AND x.STATUS = 1
|
||||||
|
INNER JOIN tb_user y ON x.user_id = y.user_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
count(*) AS ordersCount,
|
||||||
|
aa.qds_code
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
o1.orders_id,
|
||||||
|
o1.user_id,
|
||||||
|
o1.qds_code
|
||||||
|
FROM
|
||||||
|
orders o1
|
||||||
|
LEFT JOIN orders o2 ON o1.old_orders_id = o2.orders_id
|
||||||
|
AND o2.STATUS != 4
|
||||||
|
LEFT JOIN orders o3 ON o2.old_orders_id = o3.orders_id
|
||||||
|
AND o3.STATUS != 4
|
||||||
|
WHERE
|
||||||
|
o1.old_orders_id IS NOT NULL
|
||||||
|
AND o1.STATUS IN ( 3, 5 ) UNION ALL
|
||||||
|
SELECT
|
||||||
|
o1.orders_id,
|
||||||
|
o1.user_id,
|
||||||
|
o1.qds_code
|
||||||
|
FROM
|
||||||
|
orders o1
|
||||||
|
WHERE
|
||||||
|
o1.parent_id = 0
|
||||||
|
AND o1.old_orders_id IS NULL
|
||||||
|
AND o1.orders_id NOT IN ( SELECT orders_id FROM orders WHERE old_orders_id IS NOT NULL AND STATUS != 4 )
|
||||||
|
AND o1.orders_id NOT IN ( SELECT old_orders_id FROM orders WHERE old_orders_id IS NOT NULL AND STATUS != 4 )
|
||||||
|
AND o1.STATUS IN ( 3, 5 )
|
||||||
|
) aa
|
||||||
|
GROUP BY
|
||||||
|
aa.qds_code
|
||||||
|
) t1 ON t1.qds_code = bqc.
|
||||||
|
CODE LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
sum(
|
||||||
|
ifnull( qds_code_money, 0 )) money,
|
||||||
|
user_id
|
||||||
|
FROM
|
||||||
|
orders
|
||||||
|
WHERE
|
||||||
|
STATUS IN ( 3, 5, 15 )
|
||||||
|
GROUP BY
|
||||||
|
user_id
|
||||||
|
) t3 ON t3.user_id = x.user_id
|
||||||
|
WHERE
|
||||||
|
x.STATUS = 1
|
||||||
<if test="params.qdmName!=null and params.qdmName!=''">
|
<if test="params.qdmName!=null and params.qdmName!=''">
|
||||||
and bqc.name like concat('%',#{params.qdmName},'%')
|
and bqc.name like concat('%',#{params.qdmName},'%')
|
||||||
</if>
|
</if>
|
||||||
|
@ -59,7 +200,77 @@
|
||||||
<if test="params.lm!=null and params.lm!=''">
|
<if test="params.lm!=null and params.lm!=''">
|
||||||
and bqc.lm = #{params.lm}
|
and bqc.lm = #{params.lm}
|
||||||
</if>
|
</if>
|
||||||
order by x.id desc
|
|
||||||
|
) oq
|
||||||
|
LEFT JOIN bl_qds_code_record nbqcr ON oq.qdsCode = nbqcr.
|
||||||
|
CODE LEFT JOIN tb_user ntu ON oq.qdsCode = ntu.bl_qds_code
|
||||||
|
GROUP BY
|
||||||
|
oq.id,
|
||||||
|
oq.qdmName,
|
||||||
|
oq.qdsCode,
|
||||||
|
oq.lm,
|
||||||
|
oq.userName,
|
||||||
|
oq.qdsName,
|
||||||
|
oq.rate,
|
||||||
|
oq.startTime,
|
||||||
|
oq.endTime,
|
||||||
|
oq.createTime,
|
||||||
|
oq.ordersCount,
|
||||||
|
oq.money,
|
||||||
|
ntu.bl_qds_code
|
||||||
|
) nnoq
|
||||||
|
LEFT JOIN orders nnor ON nnoq.qdsCode = nnor.qds_code
|
||||||
|
AND nnor.STATUS IN ( 3, 5 )
|
||||||
|
GROUP BY
|
||||||
|
nnor.qds_code
|
||||||
|
) nnn
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
tt.qds_code qdsCode,
|
||||||
|
sum( tt.pay_money_total ) money
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
o1.qds_code,
|
||||||
|
sum((
|
||||||
|
CASE
|
||||||
|
|
||||||
|
WHEN o1.STATUS = 4 THEN
|
||||||
|
o1.pay_money + ifnull( o1.add_money, 0 ) ELSE o1.pay_money + ifnull( o1.add_money, 0 ) + ifnull( o2.pay_money, 0 ) + ifnull( o2.add_money, 0 ) + ifnull( o3.pay_money, 0 ) + ifnull( o3.add_money, 0 )
|
||||||
|
END
|
||||||
|
)) AS pay_money_total
|
||||||
|
FROM
|
||||||
|
orders o1
|
||||||
|
LEFT JOIN orders o2 ON o1.old_orders_id = o2.orders_id
|
||||||
|
AND o2.STATUS != 4
|
||||||
|
LEFT JOIN orders o3 ON o2.old_orders_id = o3.orders_id
|
||||||
|
AND o3.STATUS != 4
|
||||||
|
WHERE
|
||||||
|
o1.old_orders_id IS NOT NULL
|
||||||
|
AND o1.STATUS NOT IN ( 4, 11, 15 )
|
||||||
|
AND o1.qds_code IS NOT NULL
|
||||||
|
GROUP BY
|
||||||
|
o1.qds_code UNION ALL
|
||||||
|
SELECT
|
||||||
|
o1.qds_code,
|
||||||
|
sum((
|
||||||
|
o1.pay_money + ifnull( o1.add_money, 0 ))) AS pay_money_total
|
||||||
|
FROM
|
||||||
|
orders o1
|
||||||
|
WHERE
|
||||||
|
o1.parent_id = 0
|
||||||
|
AND o1.old_orders_id IS NULL
|
||||||
|
AND o1.orders_id NOT IN ( SELECT orders_id FROM orders WHERE old_orders_id IS NOT NULL AND STATUS != 4 )
|
||||||
|
AND o1.orders_id NOT IN ( SELECT old_orders_id FROM orders WHERE old_orders_id IS NOT NULL AND STATUS != 4 )
|
||||||
|
AND o1.qds_code IS NOT NULL
|
||||||
|
GROUP BY
|
||||||
|
o1.qds_code
|
||||||
|
) tt
|
||||||
|
GROUP BY
|
||||||
|
tt.qds_code
|
||||||
|
) nnnttm ON nnn.qdsCode = nnnttm.qdsCode
|
||||||
|
ORDER BY
|
||||||
|
nnn.id DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="invitationUserPage" resultType="com.sqx.modules.bl.commission.qds.entity.QdsData">
|
<select id="invitationUserPage" resultType="com.sqx.modules.bl.commission.qds.entity.QdsData">
|
||||||
|
|
|
@ -57,6 +57,10 @@
|
||||||
update bl_massage_package set is_tj=#{isTj} where id=#{id}
|
update bl_massage_package set is_tj=#{isTj} where id=#{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="updateTg" parameterType="com.sqx.modules.bl.massage.entity.MassagePackage">
|
||||||
|
update bl_massage_package set is_tg=#{isTg} where id=#{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
<update id="updateStatus" parameterType="com.sqx.modules.bl.massage.entity.MassagePackage">
|
<update id="updateStatus" parameterType="com.sqx.modules.bl.massage.entity.MassagePackage">
|
||||||
update bl_massage_package set status=#{status} where id=#{id}
|
update bl_massage_package set status=#{status} where id=#{id}
|
||||||
</update>
|
</update>
|
||||||
|
@ -97,6 +101,9 @@
|
||||||
<if test="params.isTj!=null">
|
<if test="params.isTj!=null">
|
||||||
and a.is_tj = #{params.isTj}
|
and a.is_tj = #{params.isTj}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="params.type!=null">
|
||||||
|
and a.is_tg = #{params.isTg}
|
||||||
|
</if>
|
||||||
union all
|
union all
|
||||||
select massage_type_id as id,title,classify_id as type,b.value as type_name,old_price,price,massage_img,jianjie,content_img,add_num,sales,labels,'项目' as flag,1 as is_can_coupon,1 as is_can_vip,
|
select massage_type_id as id,title,classify_id as type,b.value as type_name,old_price,price,massage_img,jianjie,content_img,add_num,sales,labels,'项目' as flag,1 as is_can_coupon,1 as is_can_vip,
|
||||||
1 as service_count, 0 as level
|
1 as service_count, 0 as level
|
||||||
|
@ -119,6 +126,9 @@
|
||||||
<if test="params.isTj!=null">
|
<if test="params.isTj!=null">
|
||||||
and a.is_tj = #{params.isTj}
|
and a.is_tj = #{params.isTj}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="params.type!=null">
|
||||||
|
and a.is_tg = #{params.isTg}
|
||||||
|
</if>
|
||||||
order by sales desc,id asc
|
order by sales desc,id asc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,15 @@
|
||||||
<mapper namespace="com.sqx.modules.coupon.dao.CouponDao">
|
<mapper namespace="com.sqx.modules.coupon.dao.CouponDao">
|
||||||
|
|
||||||
<select id="selectCouponPage" resultType="com.sqx.modules.coupon.entity.Coupon">
|
<select id="selectCouponPage" resultType="com.sqx.modules.coupon.entity.Coupon">
|
||||||
select t.* from coupon t
|
select t.*,s.title as goodsName from coupon t
|
||||||
|
LEFT JOIN self_goods s on s.id = t.goods_id
|
||||||
where 1=1
|
where 1=1
|
||||||
order by coupon_id desc
|
order by coupon_id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectCouponList" resultType="com.sqx.modules.coupon.entity.Coupon">
|
<select id="selectCouponList" resultType="com.sqx.modules.coupon.entity.Coupon">
|
||||||
select t.* from coupon t
|
select t.*,s.title as goodsName from coupon t
|
||||||
|
LEFT JOIN self_goods s on s.id = t.goods_id
|
||||||
where 1=1
|
where 1=1
|
||||||
order by coupon_id desc
|
order by coupon_id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -91,6 +91,11 @@
|
||||||
</if>
|
</if>
|
||||||
order by a.credit_score
|
order by a.credit_score
|
||||||
</select>
|
</select>
|
||||||
|
<select id="queryComplaints" resultType="com.sqx.modules.message.entity.MessageInfo">
|
||||||
|
select by_user_name byUserName,count(by_user_id) cs from message_info where state = 7 and by_user_name = '平台' group by by_user_id
|
||||||
|
union all
|
||||||
|
(select by_user_name byUserName,count(by_user_id) cs from message_info where state = 7 and by_user_name != '平台' group by by_user_id order by cs desc)
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue