分账逻辑及逻辑接入及分账记录查询
This commit is contained in:
parent
25e6e6788d
commit
63df84fa7c
@ -21,6 +21,7 @@ import com.ycwl.basic.model.pc.source.entity.SourceEntity;
|
||||
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
||||
import com.ycwl.basic.model.pc.video.entity.VideoEntity;
|
||||
import com.ycwl.basic.model.pc.video.resp.VideoRespVO;
|
||||
import com.ycwl.basic.profitsharing.biz.ProfitSharingBiz;
|
||||
import com.ycwl.basic.repository.FaceRepository;
|
||||
import com.ycwl.basic.repository.OrderRepository;
|
||||
import com.ycwl.basic.repository.ScenicRepository;
|
||||
@ -61,6 +62,8 @@ public class OrderBiz {
|
||||
private OrderMapper orderMapper;
|
||||
@Autowired
|
||||
private SourceMapper sourceMapper;
|
||||
@Autowired
|
||||
private ProfitSharingBiz profitSharingBiz;
|
||||
|
||||
public PriceObj queryPrice(Long scenicId, int goodsType, Long goodsId) {
|
||||
PriceObj priceObj = new PriceObj();
|
||||
@ -212,6 +215,7 @@ public class OrderBiz {
|
||||
statisticsRecordAddReq.setScenicId(order.getScenicId());
|
||||
statisticsRecordAddReq.setMorphId(orderId);
|
||||
statisticsMapper.addStatisticsRecord(statisticsRecordAddReq);
|
||||
profitSharingBiz.processProfitSharing(order.getScenicId(), orderId, order.getPayPrice());
|
||||
}
|
||||
|
||||
public void cancelOrder(Long orderId) {
|
||||
@ -232,6 +236,7 @@ public class OrderBiz {
|
||||
}
|
||||
});
|
||||
orderRepository.clearOrderCache(orderId); // 更新完了,清理下
|
||||
profitSharingBiz.revokeProfitSharing(order.getScenicId(), orderId);
|
||||
}
|
||||
|
||||
public void refundOrder(Long orderId) {
|
||||
@ -253,5 +258,6 @@ public class OrderBiz {
|
||||
}
|
||||
});
|
||||
orderRepository.clearOrderCache(orderId); // 更新完了,清理下
|
||||
profitSharingBiz.revokeProfitSharing(order.getScenicId(), orderId);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
package com.ycwl.basic.controller.pc;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.model.pc.profitsharing.resp.ProfitSharingRecordRespVO;
|
||||
import com.ycwl.basic.service.pc.ProfitSharingRecordService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/profitSharingRecord/v1")
|
||||
@Api(tags = "利润分成记录相关接口")
|
||||
public class ProfitSharingRecordController {
|
||||
|
||||
@Autowired
|
||||
private ProfitSharingRecordService profitSharingRecordService;
|
||||
|
||||
@ApiOperation("根据景区ID查询利润分成记录,支持分页,按创建时间倒序")
|
||||
@GetMapping("/page")
|
||||
public ApiResponse<PageInfo<ProfitSharingRecordRespVO>> findByScenicId(@RequestParam(required = false) Long scenicId, @RequestParam int pageNum, @RequestParam int pageSize) {
|
||||
PageHelper.startPage(pageNum, pageSize, "create_time desc");
|
||||
List<ProfitSharingRecordRespVO> records = profitSharingRecordService.findByScenicId(scenicId);
|
||||
PageInfo<ProfitSharingRecordRespVO> pageInfo = new PageInfo<>(records);
|
||||
return ApiResponse.success(pageInfo);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.ycwl.basic.model.pc.profitsharing.resp;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "利润分成记录响应VO")
|
||||
public class ProfitSharingRecordRespVO {
|
||||
@ApiModelProperty(value = "记录ID")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "景区ID")
|
||||
private Long scenicId;
|
||||
private String scenicName;
|
||||
|
||||
@ApiModelProperty(value = "订单ID")
|
||||
private Long orderId;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "用户名")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty(value = "分成金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@ApiModelProperty(value = "微信分成金额")
|
||||
private BigDecimal wxAmount;
|
||||
|
||||
@ApiModelProperty(value = "手动分成金额")
|
||||
private BigDecimal manualAmount;
|
||||
|
||||
@ApiModelProperty(value = "微信分账比例模式")
|
||||
private Integer rateMode;
|
||||
|
||||
@ApiModelProperty(value = "微信分账比例")
|
||||
private BigDecimal wxRate;
|
||||
|
||||
@ApiModelProperty(value = "实际分账比例")
|
||||
private BigDecimal realRate;
|
||||
|
||||
@ApiModelProperty(value = "订单金额")
|
||||
private BigDecimal orderAmount;
|
||||
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
}
|
@ -3,9 +3,9 @@ package com.ycwl.basic.profitsharing.biz;
|
||||
import com.ycwl.basic.profitsharing.entity.ProfitSharingConfig;
|
||||
import com.ycwl.basic.profitsharing.entity.ProfitSharingRecord;
|
||||
import com.ycwl.basic.profitsharing.entity.ProfitSharingUser;
|
||||
import com.ycwl.basic.profitsharing.mapper.ProfitSharingConfigMapper;
|
||||
import com.ycwl.basic.profitsharing.mapper.ProfitSharingRecordMapper;
|
||||
import com.ycwl.basic.profitsharing.repository.ProfitSharingRepository;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -14,7 +14,9 @@ import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ProfitSharingBiz {
|
||||
@Autowired
|
||||
@ -28,21 +30,27 @@ public class ProfitSharingBiz {
|
||||
if (config == null || config.getUsers() == null || config.getUsers().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<ProfitSharingRecord> records = new ArrayList<>();
|
||||
BigDecimal totalPercentage = BigDecimal.ZERO;
|
||||
for (ProfitSharingUser user : config.getUsers()) {
|
||||
totalPercentage = totalPercentage.add(user.getRealRate());
|
||||
}
|
||||
if (totalPercentage.compareTo(BigDecimal.valueOf(100)) > 0) {
|
||||
throw new RuntimeException("分账比例总和超过100%");
|
||||
}
|
||||
BigDecimal myPercentage = BigDecimal.valueOf(100).subtract(totalPercentage);
|
||||
|
||||
for (ProfitSharingUser user : config.getUsers()) {
|
||||
BigDecimal userAmount = amount.multiply(user.getRealRate()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN);
|
||||
BigDecimal wxAmount = amount.multiply(user.getWxRate()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN);
|
||||
BigDecimal manualAmount = userAmount.subtract(wxAmount);
|
||||
List<ProfitSharingUser> alreadyProcessedUsers = new ArrayList<>();
|
||||
// 先找出1,3的用户
|
||||
config.getUsers().stream().filter(user -> user.getRateMode() == 1 || user.getRateMode() == 3).forEach(user -> {
|
||||
if (alreadyProcessedUsers.contains(user)) {
|
||||
return;
|
||||
}
|
||||
BigDecimal userAmount;
|
||||
BigDecimal wxAmount;
|
||||
BigDecimal manualAmount;
|
||||
if (user.getRateMode() == 1) { // 比例抽成
|
||||
userAmount = amount.multiply(user.getRealRate()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN);
|
||||
wxAmount = amount.multiply(user.getWxRate()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN);
|
||||
manualAmount = userAmount.subtract(wxAmount);
|
||||
} else if (user.getRateMode() == 3) { // 固定抽成
|
||||
userAmount = user.getRealRate();
|
||||
wxAmount = user.getWxRate();
|
||||
manualAmount = userAmount.subtract(wxAmount);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
ProfitSharingRecord record = new ProfitSharingRecord();
|
||||
record.setScenicId(scenicId);
|
||||
record.setOrderId(orderId);
|
||||
@ -51,28 +59,146 @@ public class ProfitSharingBiz {
|
||||
record.setAmount(userAmount);
|
||||
record.setWxAmount(wxAmount);
|
||||
record.setManualAmount(manualAmount);
|
||||
record.setRateMode(user.getRateMode());
|
||||
record.setWxRate(user.getWxRate());
|
||||
record.setRealRate(user.getRealRate());
|
||||
record.setOrderAmount(amount);
|
||||
record.setCreateTime(new Date());
|
||||
records.add(record);
|
||||
alreadyProcessedUsers.add(user);
|
||||
});
|
||||
final BigDecimal mode2RemainAmount = amount.subtract(records.stream().map(ProfitSharingRecord::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
// 找出2的用户
|
||||
config.getUsers().stream().filter(user -> user.getRateMode() == 2).forEach(user -> {
|
||||
if (alreadyProcessedUsers.contains(user)) {
|
||||
return;
|
||||
}
|
||||
BigDecimal userAmount;
|
||||
BigDecimal wxAmount;
|
||||
BigDecimal manualAmount;
|
||||
if (user.getRateMode() == 2) { // 扣除固定抽成后的动态比例
|
||||
userAmount = mode2RemainAmount.multiply(user.getRealRate()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN);
|
||||
wxAmount = mode2RemainAmount.multiply(user.getWxRate()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN);
|
||||
manualAmount = userAmount.subtract(wxAmount);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
ProfitSharingRecord record = new ProfitSharingRecord();
|
||||
record.setScenicId(scenicId);
|
||||
record.setOrderId(orderId);
|
||||
record.setUserId(user.getId());
|
||||
record.setUserName(user.getName());
|
||||
record.setAmount(userAmount);
|
||||
record.setWxAmount(wxAmount);
|
||||
record.setManualAmount(manualAmount);
|
||||
record.setRateMode(user.getRateMode());
|
||||
record.setWxRate(user.getWxRate());
|
||||
record.setRealRate(user.getRealRate());
|
||||
record.setOrderAmount(amount);
|
||||
record.setCreateTime(new Date());
|
||||
records.add(record);
|
||||
alreadyProcessedUsers.add(user);
|
||||
});
|
||||
final BigDecimal mode4RemainAmount = amount.subtract(records.stream().map(ProfitSharingRecord::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
// 找出4的用户
|
||||
config.getUsers().stream().filter(user -> user.getRateMode() == 4).forEach(user -> {
|
||||
if (alreadyProcessedUsers.contains(user)) {
|
||||
return;
|
||||
}
|
||||
BigDecimal userAmount;
|
||||
BigDecimal wxAmount;
|
||||
BigDecimal manualAmount;
|
||||
if (user.getRateMode() == 4) { // 扣除其他所有类型抽成后的动态比例
|
||||
userAmount = mode4RemainAmount.multiply(user.getRealRate()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN);
|
||||
wxAmount = mode4RemainAmount.multiply(user.getWxRate()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN);
|
||||
manualAmount = userAmount.subtract(wxAmount);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
ProfitSharingRecord record = new ProfitSharingRecord();
|
||||
record.setScenicId(scenicId);
|
||||
record.setOrderId(orderId);
|
||||
record.setUserId(user.getId());
|
||||
record.setUserName(user.getName());
|
||||
record.setAmount(userAmount);
|
||||
record.setWxAmount(wxAmount);
|
||||
record.setManualAmount(manualAmount);
|
||||
record.setRateMode(user.getRateMode());
|
||||
record.setWxRate(user.getWxRate());
|
||||
record.setRealRate(user.getRealRate());
|
||||
record.setOrderAmount(amount);
|
||||
record.setCreateTime(new Date());
|
||||
records.add(record);
|
||||
alreadyProcessedUsers.add(user);
|
||||
});
|
||||
final BigDecimal mode0RemainAmount = amount.subtract(records.stream().map(ProfitSharingRecord::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
// 找出0的用户
|
||||
List<ProfitSharingUser> mode0User = config.getUsers().stream().filter(user -> user.getRateMode() == 0).collect(Collectors.toList());
|
||||
mode0User.forEach(user -> {
|
||||
if (alreadyProcessedUsers.contains(user)) {
|
||||
return;
|
||||
}
|
||||
BigDecimal userAmount;
|
||||
BigDecimal wxAmount;
|
||||
BigDecimal manualAmount;
|
||||
if (user.getRateMode() == 0) { // 剩余比例
|
||||
userAmount = mode0RemainAmount.divide(BigDecimal.valueOf(mode0User.size()), 2, RoundingMode.HALF_DOWN);
|
||||
wxAmount = mode0RemainAmount.divide(BigDecimal.valueOf(mode0User.size()), 2, RoundingMode.HALF_DOWN);
|
||||
manualAmount = userAmount.subtract(wxAmount);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
ProfitSharingRecord record = new ProfitSharingRecord();
|
||||
record.setScenicId(scenicId);
|
||||
record.setOrderId(orderId);
|
||||
record.setUserId(user.getId());
|
||||
record.setUserName(user.getName());
|
||||
record.setAmount(userAmount);
|
||||
record.setWxAmount(wxAmount);
|
||||
record.setManualAmount(manualAmount);
|
||||
record.setRateMode(user.getRateMode());
|
||||
record.setWxRate(user.getWxRate());
|
||||
record.setRealRate(user.getRealRate());
|
||||
record.setOrderAmount(amount);
|
||||
record.setCreateTime(new Date());
|
||||
records.add(record);
|
||||
alreadyProcessedUsers.add(user);
|
||||
});
|
||||
// 没有操作过的用户
|
||||
config.getUsers().stream().filter(user -> !alreadyProcessedUsers.contains(user)).forEach(user -> {
|
||||
ProfitSharingRecord record = new ProfitSharingRecord();
|
||||
record.setScenicId(scenicId);
|
||||
record.setOrderId(orderId);
|
||||
record.setUserId(user.getId());
|
||||
record.setUserName(user.getName());
|
||||
record.setAmount(BigDecimal.ZERO);
|
||||
record.setWxAmount(BigDecimal.ZERO);
|
||||
record.setManualAmount(BigDecimal.ZERO);
|
||||
record.setRateMode(user.getRateMode());
|
||||
record.setWxRate(user.getWxRate());
|
||||
record.setRealRate(user.getRealRate());
|
||||
record.setOrderAmount(amount);
|
||||
record.setCreateTime(new Date());
|
||||
records.add(record);
|
||||
alreadyProcessedUsers.add(user);
|
||||
});
|
||||
final BigDecimal remainAmount = amount.subtract(records.stream().map(ProfitSharingRecord::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
if (remainAmount.compareTo(BigDecimal.ZERO) < 0) {
|
||||
log.error("分账剩余金额不足!!! scenicId: {}, orderId: {}, amount: {}, config: {}", scenicId, orderId, amount, config);
|
||||
return;
|
||||
}
|
||||
BigDecimal remainAmount = amount;
|
||||
for (ProfitSharingRecord record : records) {
|
||||
remainAmount = remainAmount.subtract(record.getAmount());
|
||||
}
|
||||
|
||||
if (remainAmount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
ProfitSharingRecord record = new ProfitSharingRecord();
|
||||
record.setScenicId(scenicId);
|
||||
record.setOrderId(orderId);
|
||||
record.setUserId(0L);
|
||||
record.setUserName("自己");
|
||||
record.setUserName("分账剩余");
|
||||
record.setRateMode(-1);
|
||||
record.setAmount(remainAmount);
|
||||
record.setWxAmount(BigDecimal.ZERO);
|
||||
record.setManualAmount(remainAmount);
|
||||
record.setWxRate(BigDecimal.ZERO);
|
||||
record.setRealRate(myPercentage);
|
||||
record.setRealRate(BigDecimal.ZERO);
|
||||
record.setOrderAmount(amount);
|
||||
record.setCreateTime(new Date());
|
||||
records.add(record);
|
||||
@ -81,4 +207,7 @@ public class ProfitSharingBiz {
|
||||
recordMapper.batchInsert(records);
|
||||
}
|
||||
|
||||
public void revokeProfitSharing(Long scenicId, Long orderId) {
|
||||
recordMapper.deleteByScenicIdAndOrderId(scenicId, orderId);
|
||||
}
|
||||
}
|
@ -15,8 +15,10 @@ public class ProfitSharingRecord {
|
||||
private BigDecimal amount;
|
||||
private BigDecimal wxAmount;
|
||||
private BigDecimal manualAmount;
|
||||
private Integer rateMode; // 微信分账比例
|
||||
private BigDecimal wxRate; // 微信分账比例
|
||||
private BigDecimal realRate; // 实际分账比例
|
||||
private BigDecimal orderAmount; // 订单金额
|
||||
private Integer status;
|
||||
private Date createTime;
|
||||
}
|
@ -15,6 +15,10 @@ public class ProfitSharingUser {
|
||||
private Map<String, String> wxPayConfig;
|
||||
private String name;
|
||||
private String description;
|
||||
/**
|
||||
* 分账比例模式,0:剩余模式,1:固定比例,2:扣除固定抽成后的动态比例,3:固定抽成,4:扣除其他所有类型抽成后的动态比例
|
||||
*/
|
||||
private Integer rateMode;
|
||||
/**
|
||||
* 微信分账比例,单位为%
|
||||
*/
|
||||
|
@ -1,15 +1,20 @@
|
||||
package com.ycwl.basic.profitsharing.mapper;
|
||||
|
||||
import com.ycwl.basic.model.pc.profitsharing.resp.ProfitSharingRecordRespVO;
|
||||
import com.ycwl.basic.profitsharing.entity.ProfitSharingRecord;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Options;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ProfitSharingRecordMapper {
|
||||
List<ProfitSharingRecordRespVO> findByScenicId(@Param("scenicId") Long scenicId);
|
||||
|
||||
void batchInsert(List<ProfitSharingRecord> records);
|
||||
|
||||
@Delete("DELETE FROM profit_sharing_record WHERE scenic_id = #{scenicId} AND order_id = #{orderId}")
|
||||
|
@ -7,15 +7,18 @@ import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ProfitSharingUserMapper {
|
||||
@Insert("INSERT INTO profit_sharing_user (config_id, wx_pay_type, wx_pay_config, name, description, wx_rate, real_rate) " +
|
||||
"VALUES (#{configId}, #{wxPayType}, #{wxPayConfig}, #{name}, #{description}, #{wxRate}, #{realRate})")
|
||||
@Insert("INSERT INTO profit_sharing_user (config_id, name, description, wx_rate, real_rate, rate_mode) " +
|
||||
"VALUES (#{configId}, #{name}, #{description}, #{wxRate}, #{realRate}, #{rateMode})")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id")
|
||||
void insert(ProfitSharingUser user);
|
||||
|
||||
@Update("UPDATE profit_sharing_user SET config_id = #{configId}, wx_pay_type = #{wxPayType}, wx_pay_config = #{wxPayConfig}, " +
|
||||
"name = #{name}, description = #{description}, wx_rate = #{wxRate}, real_rate = #{realRate} WHERE id = #{id}")
|
||||
@Update("UPDATE profit_sharing_user SET config_id = #{configId}, " +
|
||||
"name = #{name}, description = #{description}, wx_rate = #{wxRate}, real_rate = #{realRate}, rate_mode = #{rateMode} WHERE id = #{id}")
|
||||
void update(ProfitSharingUser user);
|
||||
|
||||
@Update("UPDATE profit_sharing_user SET wx_pay_type = #{wxPayType}, wx_pay_config = #{wxPayConfig} WHERE id = #{id}")
|
||||
void updateWxPayConfig(ProfitSharingUser user);
|
||||
|
||||
@Delete("DELETE FROM profit_sharing_user WHERE id = #{id}")
|
||||
void deleteById(Long id);
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.ycwl.basic.service.impl.pc;
|
||||
|
||||
import com.ycwl.basic.model.pc.profitsharing.resp.ProfitSharingRecordRespVO;
|
||||
import com.ycwl.basic.profitsharing.mapper.ProfitSharingRecordMapper;
|
||||
import com.ycwl.basic.service.pc.ProfitSharingRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ProfitSharingRecordServiceImpl implements ProfitSharingRecordService {
|
||||
|
||||
@Autowired
|
||||
private ProfitSharingRecordMapper profitSharingRecordMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<ProfitSharingRecordRespVO> findByScenicId(Long scenicId) {
|
||||
return profitSharingRecordMapper.findByScenicId(scenicId);
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package com.ycwl.basic.service.pc;
|
||||
|
||||
import com.ycwl.basic.model.pc.profitsharing.resp.ProfitSharingRecordRespVO;
|
||||
import java.util.List;
|
||||
|
||||
public interface ProfitSharingRecordService {
|
||||
List<ProfitSharingRecordRespVO> findByScenicId(Long scenicId);
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package com.ycwl.basic.utils;
|
||||
|
||||
import com.ycwl.basic.model.pc.faceSample.entity.FaceSampleEntity;
|
||||
import com.ycwl.basic.model.pc.faceSample.resp.FaceSampleRespVO;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
public class AliFaceUtil {
|
||||
}
|
@ -1,137 +0,0 @@
|
||||
//package com.ycwl.smartPark.utils;
|
||||
//
|
||||
//import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
|
||||
//import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
//import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
//import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||
//import com.baomidou.mybatisplus.generator.InjectionConfig;
|
||||
//import com.baomidou.mybatisplus.generator.config.*;
|
||||
//import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
//import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
||||
//import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//import java.util.Scanner;
|
||||
//
|
||||
///**
|
||||
// * 执行 main 方法控制台输入模块表名回车自动生成对应项目目录中
|
||||
// *
|
||||
// * @author songmingsong
|
||||
// * @since 1.0.0
|
||||
// */
|
||||
//
|
||||
//public class CodeGenerator {
|
||||
//
|
||||
// /**
|
||||
// * <p>
|
||||
// * 读取控制台内容
|
||||
// * </p>
|
||||
// */
|
||||
// public static String scanner(String tip) {
|
||||
// Scanner scanner = new Scanner(System.in);
|
||||
// StringBuilder help = new StringBuilder();
|
||||
// help.append("请输入" + tip + ":");
|
||||
// System.out.println(help.toString());
|
||||
// if (scanner.hasNext()) {
|
||||
// String ipt = scanner.next();
|
||||
// if (StringUtils.isNotEmpty(ipt)) {
|
||||
// return ipt;
|
||||
// }
|
||||
// }
|
||||
// throw new MybatisPlusException("请输入正确的" + tip + "!");
|
||||
// }
|
||||
//
|
||||
// public static void main(String[] args) {
|
||||
// // 代码生成器
|
||||
// AutoGenerator mpg = new AutoGenerator();
|
||||
//
|
||||
// // 全局配置
|
||||
// GlobalConfig gc = new GlobalConfig();
|
||||
// String projectPath = System.getProperty("user.dir");
|
||||
// // 生成到那个模块下
|
||||
// gc.setOutputDir(projectPath + "/src/main/java");
|
||||
// //作者
|
||||
// gc.setAuthor("songmingsong");
|
||||
// //打开输出目录
|
||||
// gc.setOpen(false);
|
||||
// //xml开启 BaseResultMap
|
||||
// gc.setBaseResultMap(true);
|
||||
// //xml 开启BaseColumnList
|
||||
// gc.setBaseColumnList(true);
|
||||
// // 实体属性 Swagger2 注解
|
||||
// gc.setSwagger2(true);
|
||||
// mpg.setGlobalConfig(gc);
|
||||
//
|
||||
// // 数据源配置
|
||||
// DataSourceConfig dsc = new DataSourceConfig();
|
||||
// dsc.setUrl("jdbc:mysql://49.4.2.89:3306/smart_park?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia" +
|
||||
// "/Shanghai");
|
||||
// dsc.setDriverName("com.mysql.cj.jdbc.Driver");
|
||||
// dsc.setUsername("root");
|
||||
// dsc.setPassword("yckj@2017");
|
||||
// mpg.setDataSource(dsc);
|
||||
//
|
||||
// // 包配置
|
||||
// PackageConfig pc = new PackageConfig();
|
||||
// pc.setParent("com.ycwl.smartPark")
|
||||
// .setEntity("model.app.notice.entity")
|
||||
// .setMapper("mapper.app")
|
||||
// .setService("service.app")
|
||||
// .setServiceImpl("service.impl.app")
|
||||
// .setController("controller.app");
|
||||
// mpg.setPackageInfo(pc);
|
||||
//
|
||||
// // 自定义配置
|
||||
// InjectionConfig cfg = new InjectionConfig() {
|
||||
// @Override
|
||||
// public void initMap() {
|
||||
// // to do nothing
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// // 如果模板引擎是 freemarker
|
||||
// String templatePath = "/templates/mapper.xml.ftl";
|
||||
// // 如果模板引擎是 velocity
|
||||
// // String templatePath = "/templates/mapper.xml.vm";
|
||||
//
|
||||
// // 自定义输出配置
|
||||
// List<FileOutConfig> focList = new ArrayList<>();
|
||||
// // 自定义配置会被优先输出
|
||||
// focList.add(new FileOutConfig(templatePath) {
|
||||
// @Override
|
||||
// public String outputFile(TableInfo tableInfo) {
|
||||
// // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
|
||||
// return projectPath + "/src/main/resources/mapper/" + tableInfo.getEntityName() + "Mapper"
|
||||
// + StringPool.DOT_XML;
|
||||
// }
|
||||
// });
|
||||
// cfg.setFileOutConfigList(focList);
|
||||
// mpg.setCfg(cfg);
|
||||
//
|
||||
// // 配置模板
|
||||
// TemplateConfig templateConfig = new TemplateConfig();
|
||||
//
|
||||
// templateConfig.setXml(null);
|
||||
// mpg.setTemplate(templateConfig);
|
||||
//
|
||||
// // 策略配置
|
||||
// StrategyConfig strategy = new StrategyConfig();
|
||||
// //数据库表映射到实体的命名策略
|
||||
// strategy.setNaming(NamingStrategy.underline_to_camel);
|
||||
// //数据库表字段映射到实体的命名策略
|
||||
// strategy.setColumnNaming(NamingStrategy.no_change);
|
||||
// //lombok模型
|
||||
// strategy.setEntityLombokModel(true);
|
||||
// //生成 @RestController 控制器
|
||||
// strategy.setRestControllerStyle(true);
|
||||
// strategy.setInclude(scanner("表名,多个英文逗号分割").split(","));
|
||||
// strategy.setControllerMappingHyphenStyle(true);
|
||||
// //表前缀
|
||||
// strategy.setTablePrefix("t_");
|
||||
// mpg.setStrategy(strategy);
|
||||
// mpg.setTemplateEngine(new FreemarkerTemplateEngine());
|
||||
// mpg.execute();
|
||||
// }
|
||||
//
|
||||
//}
|
@ -8,4 +8,15 @@
|
||||
(#{record.scenicId}, #{record.orderId}, #{record.userId}, #{record.userName}, #{record.amount}, #{record.wxAmount}, #{record.manualAmount}, #{record.wxRate}, #{record.realRate}, #{record.orderAmount}, #{record.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
<select id="findByScenicId" resultType="com.ycwl.basic.model.pc.profitsharing.resp.ProfitSharingRecordRespVO">
|
||||
SELECT r.*, s.name as scenic_name
|
||||
FROM profit_sharing_record r
|
||||
LEFT JOIN scenic s ON s.id = r.scenic_id
|
||||
<where>
|
||||
<if test="scenicId != null">
|
||||
AND r.scenic_id = #{scenicId}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY r.create_time desc
|
||||
</select>
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user