Merge remote-tracking branch 'origin/master-v2' into master-v2
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.flower; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class FlowerMarkupSpSaveBatchDTO { |
| | | @ApiModelProperty(value = "商品ids") |
| | | private List<Long> flowerIds; |
| | | |
| | | @ApiModelProperty(value = "金额") |
| | | private BigDecimal fee; |
| | | |
| | | @ApiModelProperty(value = "合伙人ID") |
| | | private Long partnerId; |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "是否绑定微信") |
| | | private Boolean bindWechat; |
| | | |
| | | @ApiModelProperty(value = "当前积分") |
| | | private Integer currentPoint; |
| | | } |
| | |
| | | package com.mzl.flower.dto.response.customer; |
| | | |
| | | import com.mzl.flower.dto.request.menber.UserGrowthRecordDTO; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | @ApiModelProperty("更新时间") |
| | | private LocalDateTime updateTime; |
| | | |
| | | private UserGrowthRecordDTO userGrowthRecord; |
| | | } |
| | |
| | | public interface FlowerMarkupSpMapper extends BaseMapper<FlowerMarkupSp> { |
| | | List<FlowerMarkupSpListDTO> selectMarkupSpList(Page page, @Param("partnerId") Long partnerId |
| | | , @Param("condition") FlowerMarkupSpQueryDTO dto); |
| | | |
| | | List<FlowerMarkupSpListDTO> selectMarkupSpFlowerList(Page page, @Param("partnerId") Long partnerId |
| | | , @Param("condition") FlowerMarkupSpQueryDTO dto); |
| | | } |
| | |
| | | @Repository |
| | | public interface MemberGrowthRecordMapper extends BaseMapper<MemberGrowthRecord> { |
| | | |
| | | @Select("SELECT CASE WHEN SUM(growth) < 0 THEN 0 ELSE SUM(growth) END as total_growth from t_member_growth_record WHERE user_id = #{userId} and deleted = '0'") |
| | | @Select("SELECT COALESCE(CASE WHEN SUM(growth) < 0 THEN 0 ELSE SUM(growth) END, 0) as total_growth from t_member_growth_record WHERE user_id = #{userId} and deleted = '0'") |
| | | Integer getSumGrowthByUsertId(@Param("userId") String userId); |
| | | |
| | | List<MemberGrowthRecordVO> queryPage(@Param("dto") MemberRecordQueryDTO dto, Page page); |
| | |
| | | customerPointDetail.setChangeType(Constants.POINT_CHANGE_TYPE.reduce.name()); |
| | | customerPointDetail.setType(Constants.POINT_TYPE.expired.name()); |
| | | customerPointDetail.setPoint(expiredPoint); |
| | | customerPointDetail.setRecordDate(now); |
| | | customerPointDetail.setRecordDate(lastYear); |
| | | customerPointDetail.create("sys"); |
| | | customerPointDetail.setRemarks(DateUtils.toString(now,"yyyy-MM-dd")+"过期积分结算"); |
| | | customerPointDetailMapper.insert(customerPointDetail); |
| | |
| | | import com.mzl.flower.dto.request.customer.ChangePartnerDTO; |
| | | import com.mzl.flower.dto.request.customer.QueryCustomerDTO; |
| | | import com.mzl.flower.dto.request.customer.UpdateCustomerDTO; |
| | | import com.mzl.flower.dto.request.menber.UserGrowthRecordDTO; |
| | | import com.mzl.flower.dto.response.customer.CustomerDTO; |
| | | import com.mzl.flower.dto.response.partner.PartnerDTO; |
| | | import com.mzl.flower.entity.customer.Customer; |
| | |
| | | import com.mzl.flower.enums.TrueOrFalseEnum; |
| | | import com.mzl.flower.mapper.customer.CustomerMapper; |
| | | import com.mzl.flower.mapper.partner.PartnerMapper; |
| | | import com.mzl.flower.service.menber.MemberGrowthRecordService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | private final CustomerMapper customerMapper; |
| | | |
| | | private final PartnerMapper partnerMapper; |
| | | @Resource |
| | | private MemberGrowthRecordService memberGrowthRecordService; |
| | | |
| | | public CustomerService(CustomerMapper customerMapper, PartnerMapper partnerMapper) { |
| | | this.customerMapper = customerMapper; |
| | |
| | | } |
| | | |
| | | public CustomerDTO getCurrentCustomer() { |
| | | return customerMapper.getCurrentCustomer(SecurityUtils.getUserId()); |
| | | CustomerDTO currentCustomer = customerMapper.getCurrentCustomer(SecurityUtils.getUserId()); |
| | | UserGrowthRecordDTO userGrowthRecordDTO = memberGrowthRecordService.getInfoByUserId(SecurityUtils.getUserId()); |
| | | if(!ObjectUtils.isEmpty(userGrowthRecordDTO)){ |
| | | currentCustomer.setUserGrowthRecord(userGrowthRecordDTO); |
| | | } |
| | | return currentCustomer; |
| | | } |
| | | |
| | | public PartnerDTO getCurrentBindPartner() { |
| | |
| | | private FlowerMarkupSpMapper spMapper; |
| | | |
| | | public void saveMarkupSp(FlowerMarkupSpSaveDTO dto){ |
| | | |
| | | FlowerMarkupSp sp = spMapper.selectOne(new QueryWrapper<FlowerMarkupSp>() |
| | | .eq("partner_id", dto.getPartnerId()).eq("flower_id", dto.getFlowerId())); |
| | | if(sp == null){ |
| | |
| | | markupCacheClient.addMarkupSp(dto.getPartnerId(), dto.getFlowerId(), sp); |
| | | } |
| | | |
| | | public void saveMarkupSpBatch(FlowerMarkupSpSaveBatchDTO dto){ |
| | | List<Long> flowerIds = dto.getFlowerIds(); |
| | | if(flowerIds != null && flowerIds.size() > 0){ |
| | | for(Long flowerId : flowerIds){ |
| | | FlowerMarkupSpSaveDTO dt = new FlowerMarkupSpSaveDTO(); |
| | | dt.setFlowerId(flowerId); |
| | | dt.setPartnerId(dto.getPartnerId()); |
| | | dt.setFee(dto.getFee()); |
| | | |
| | | saveMarkupSp(dt); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public FlowerMarkupSpDTO getMarkupSp(Long flowerId){ |
| | | FlowerMarkupSpDTO dto = new FlowerMarkupSpDTO(); |
| | | dto.setFlowerId(flowerId); |
| | |
| | | return dto; |
| | | } |
| | | |
| | | public Page<FlowerMarkupSpListDTO> selectMarkupSpFlowerList(Page page, FlowerMarkupSpQueryDTO dto){ |
| | | List<FlowerMarkupSpListDTO> ll = spMapper.selectMarkupSpFlowerList(page, dto.getPartnerId(), dto); |
| | | if(ll != null && ll.size() > 0){ |
| | | for(FlowerMarkupSpListDTO ss : ll){ |
| | | ss.setPrice(getFinalPriceForPartner(dto.getPartnerId(), ss.getCategory(), ss.getFlowerId(), ss.getPrice(), ss.getLevel())); |
| | | } |
| | | } |
| | | |
| | | page.setRecords(ll); |
| | | return page; |
| | | } |
| | | |
| | | public Page<FlowerMarkupSpListDTO> selectMarkupSpList(Page page, FlowerMarkupSpQueryDTO dto){ |
| | | |
| | | List<FlowerMarkupSpListDTO> ll = spMapper.selectMarkupSpList(page, dto.getPartnerId(), dto); |
| | |
| | | |
| | | if(checkList != null && checkList.size() > 0){ |
| | | for(OrderItemCheck c : checkList){ |
| | | if(Constants.CHECK_TYPE.replace.name().equals(c.getType())){ |
| | | continue; |
| | | } |
| | | totalAmount = totalAmount.subtract(getAmount(c.getDeductAmount())); |
| | | } |
| | | } |
| | |
| | | import com.mzl.flower.dto.response.system.MenuTreeDTO; |
| | | import com.mzl.flower.dto.response.system.UserDetailsDTO; |
| | | import com.mzl.flower.dto.response.system.UserListDTO; |
| | | import com.mzl.flower.entity.point.CustomerPoint; |
| | | import com.mzl.flower.entity.system.*; |
| | | import com.mzl.flower.enums.TrueOrFalseEnum; |
| | | import com.mzl.flower.mapper.point.CustomerPointMapper; |
| | | import com.mzl.flower.mapper.system.*; |
| | | import com.mzl.flower.service.customer.CustomerService; |
| | | import com.mzl.flower.service.partner.PartnerService; |
| | | import com.mzl.flower.service.point.CustomerPointService; |
| | | import com.mzl.flower.service.supplier.SupplierService; |
| | | import com.mzl.flower.utils.TreeBuilderUtil; |
| | | import com.mzl.flower.utils.UUIDGenerator; |
| | |
| | | |
| | | @Autowired |
| | | private EmployeeMapper employeeMapper; |
| | | |
| | | @Autowired |
| | | private CustomerPointMapper customerPointMapper; |
| | | |
| | | |
| | | public User findUserByOpenId(String openId, String sessionKey, String unionId |
| | | , String imgUrl, String nickname,String userType){ |
| | |
| | | |
| | | if(Constants.USER_TYPE.customer.name().equals(user.getType())){ |
| | | result.setCustomerDTO(customerService.getCurrentCustomer()); |
| | | //查询积分 |
| | | CustomerPoint customerPoint = customerPointMapper.selectOne(new LambdaQueryWrapper<CustomerPoint>() |
| | | .eq(CustomerPoint::getUserId, userId)); |
| | | if(customerPoint == null){ |
| | | result.setCurrentPoint(0); |
| | | }else{ |
| | | Integer currentPoint =customerPoint.getTotalPoint()-customerPoint.getUsedPoint()-customerPoint.getExpiredPoint(); |
| | | result.setCurrentPoint(currentPoint>=0?currentPoint:0); |
| | | } |
| | | }else if(Constants.USER_TYPE.supplier.name().equals(user.getType())){ |
| | | result.setSupplierDTO(supplierService.getCurrentSupplier()); |
| | | }else if(Constants.USER_TYPE.partner.name().equals(user.getType())){ |
| | |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.dto.request.flower.FlowerMarkupSpQueryDTO; |
| | | import com.mzl.flower.dto.request.flower.FlowerMarkupSpSaveBatchDTO; |
| | | import com.mzl.flower.dto.request.flower.FlowerMarkupSpSaveDTO; |
| | | import com.mzl.flower.dto.response.flower.FlowerMarkupSpDTO; |
| | | import com.mzl.flower.dto.response.flower.FlowerMarkupSpListDTO; |
| | |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "获取商品加价列表") |
| | | public ResponseEntity<ReturnDataDTO<Page<FlowerMarkupSpListDTO>>> selectMarkupSpList(Page page, FlowerMarkupSpQueryDTO dto){ |
| | | public ResponseEntity<ReturnDataDTO<Page<FlowerMarkupSpListDTO>>> selectMarkupSpList(Page page |
| | | , FlowerMarkupSpQueryDTO dto){ |
| | | Partner s = spService.getCurrentPartner(); |
| | | if(s == null){ |
| | | throw new ValidationException("未找到当前合伙人信息"); |
| | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/flower/list") |
| | | @ApiOperation(value = "获取加价商品加列表") |
| | | public ResponseEntity<ReturnDataDTO<Page<FlowerMarkupSpListDTO>>> selectMarkupSpFlowerList(Page page |
| | | , FlowerMarkupSpQueryDTO dto){ |
| | | Partner s = spService.getCurrentPartner(); |
| | | if(s == null){ |
| | | throw new ValidationException("未找到当前合伙人信息"); |
| | | } |
| | | dto.setPartnerId(s.getId()); |
| | | return returnData(R.SUCCESS.getCode(), spService.selectMarkupSpFlowerList(page, dto)); |
| | | } |
| | | |
| | | @PostMapping("/flower/list/save") |
| | | @ApiOperation(value = "批量新增商品加价") |
| | | public ResponseEntity<ReturnDataDTO> saveMarkupSpBatch(@RequestBody FlowerMarkupSpSaveBatchDTO dto) { |
| | | Partner s = spService.getCurrentPartner(); |
| | | if(s == null){ |
| | | throw new ValidationException("未找到当前合伙人信息"); |
| | | } |
| | | dto.setPartnerId(s.getId()); |
| | | spService.saveMarkupSpBatch(dto); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | } |
| | |
| | | ORDER BY f.id |
| | | </select> |
| | | |
| | | |
| | | <select id="selectMarkupSpFlowerList" resultType="com.mzl.flower.dto.response.flower.FlowerMarkupSpListDTO"> |
| | | SELECT f.*, f.id flower_id, sp.fee, s.name supplierName, c.name categoryStr, c.parent_name parentCategoryStr |
| | | , (CASE f.level |
| | | WHEN 'A' THEN c.weight_a |
| | | WHEN 'B' THEN c.weight_b |
| | | WHEN 'C' THEN c.weight_c |
| | | WHEN 'D' THEN c.weight_d |
| | | WHEN 'E' THEN c.weight_e |
| | | WHEN 'O' THEN c.weight_o |
| | | END |
| | | ) weight |
| | | FROM t_flower f |
| | | left join t_flower_markup_sp sp on sp.flower_id = f.id and sp.partner_id = #{partnerId} |
| | | left join t_supplier_info s on s.id = f.supplier_id |
| | | left join t_flower_category c on f.category = c.id |
| | | WHERE f.deleted = 0 AND f.status = 'UP' |
| | | <if test="condition.name != null and condition.name != ''"> |
| | | AND f.name LIKE concat('%', #{condition.name},'%') |
| | | </if> |
| | | <if test="condition.level != null and condition.level != ''"> |
| | | AND f.level = #{condition.level} |
| | | </if> |
| | | <if test="condition.tags != null and condition.tags != ''"> |
| | | AND f.tags LIKE concat('%', #{condition.tags},'%') |
| | | </if> |
| | | <if test="condition.category != null"> |
| | | AND (f.category = #{condition.category} |
| | | or exists ( |
| | | select 1 from t_flower_category fc where fc.id = f.category and fc.parent_id = #{condition.category} |
| | | ) |
| | | ) |
| | | </if> |
| | | ORDER BY f.id |
| | | </select> |
| | | </mapper> |