Browse Source

添加品牌规则

v1.0
Yen 2 years ago
parent
commit
65f51ceef1
  1. 9
      src/main/java/com/qs/serve/modules/bir/service/impl/BirCenterRateServiceImpl.java
  2. 11
      src/main/java/com/qs/serve/modules/bms/service/impl/BmsRegionServiceImpl.java
  3. 116
      src/main/java/com/qs/serve/modules/goods/controller/GoodsCategoryRuleController.java
  4. 102
      src/main/java/com/qs/serve/modules/goods/entity/GoodsCategoryRule.java
  5. 33
      src/main/java/com/qs/serve/modules/goods/entity/bo/GoodsCategoryRuleBo.java
  6. 14
      src/main/java/com/qs/serve/modules/goods/mapper/GoodsCategoryRuleMapper.java
  7. 17
      src/main/java/com/qs/serve/modules/goods/service/GoodsCategoryRuleService.java
  8. 55
      src/main/java/com/qs/serve/modules/goods/service/impl/GoodsCategoryRuleServiceImpl.java
  9. 2
      src/main/java/com/qs/serve/modules/pay/controller/PayPaymentController.java
  10. 1
      src/main/java/com/qs/serve/modules/tbs/service/impl/TbsBudgetChangeOperationServiceImpl.java
  11. 1
      src/main/java/com/qs/serve/modules/vtb/controller/VtbVerificationController.java

9
src/main/java/com/qs/serve/modules/bir/service/impl/BirCenterRateServiceImpl.java

@ -221,12 +221,11 @@ public class BirCenterRateServiceImpl implements BirCenterRateService {
}
//创建客户的费率
if(StringUtils.hasText(supplierCode)){
try {
this.buildCustomerCenterTargetData(centerType, centerId, costCenter, supplierCode, dispatchSumVos);
// try {
// this.buildCustomerCenterTargetData(centerType, centerId, costCenter, supplierCode, dispatchSumVos);
// } catch (Exception e) {
// log.error("[{}]创建客户成本中心的费率出现异常:{}",supplierCode,e.getMessage());
// }
} catch (Exception e) {
log.error("[{}]创建客户成本中心的费率出现异常:{}",supplierCode,e.getMessage());
}
}
return costCenter;
}

11
src/main/java/com/qs/serve/modules/bms/service/impl/BmsRegionServiceImpl.java

@ -59,7 +59,7 @@ public class BmsRegionServiceImpl extends ServiceImpl<BmsRegionMapper,BmsRegion>
BmsRegion ori = this.getById(param.getId());
param = this.flushSetLevel(param);
boolean changePid = !ori.getPid().equals(param.getPid());
boolean b = this.updateById(param);
boolean b = super.updateById(param);
if(!ori.getName().equals(param.getName())||changePid) {
String[] paths = ori.getPathIds().split("_");
for (String path : paths) {
@ -288,6 +288,15 @@ public class BmsRegionServiceImpl extends ServiceImpl<BmsRegionMapper,BmsRegion>
List<BmsRegion> regionList = this.listChild(pid);
if(regionList.size()>0){
regionList = regionList.stream().map(a->{
String[] arr = parRegion.getPathIds().split("_");
if(arr.length>3){
Assert.throwEx("层级不能超过三级");
}
for (String id : arr) {
if(id.equals(a.getId())){
Assert.throwEx("节点出现循环");
}
}
a.setPathIds(parRegion.getPathIds()+"_"+a.getId());
a.setPathNames(parRegion.getPathNames()+"_"+a.getName());
return a;

116
src/main/java/com/qs/serve/modules/goods/controller/GoodsCategoryRuleController.java

@ -0,0 +1,116 @@
package com.qs.serve.modules.goods.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.qs.serve.common.model.annotation.SysLog;
import com.qs.serve.common.model.dto.PageVo;
import com.qs.serve.common.model.dto.R;
import com.qs.serve.common.model.enums.BizType;
import com.qs.serve.common.model.enums.SystemModule;
import com.qs.serve.common.util.PageUtil;
import com.qs.serve.common.util.CopierUtil;
import com.qs.serve.common.util.StringUtils;
import com.qs.serve.modules.goods.entity.GoodsCategory;
import com.qs.serve.modules.goods.entity.bo.GoodsCategoryRuleBo;
import com.qs.serve.modules.goods.service.GoodsCategoryService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import com.qs.serve.modules.goods.entity.GoodsCategoryRule;
import com.qs.serve.modules.goods.service.GoodsCategoryRuleService;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* 商品 品牌规则
* @author YenHex
* @since 2023-09-18
*/
@Slf4j
@AllArgsConstructor
@RestController
@RequestMapping("goods/categoryRule")
public class GoodsCategoryRuleController {
private GoodsCategoryRuleService goodsCategoryRuleService;
/**
* 列表
* @param param
* @return
*/
//@GetMapping("/list")
public R<List<GoodsCategoryRule>> getList(GoodsCategoryRule param){
LambdaQueryWrapper<GoodsCategoryRule> lqw = new LambdaQueryWrapper<>(param);
List<GoodsCategoryRule> list = goodsCategoryRuleService.list(lqw);
return R.ok(list);
}
/**
* 翻页
* @param param
* @return
*/
@GetMapping("/page")
public R<PageVo<GoodsCategoryRule>> getPage(GoodsCategoryRule param){
LambdaQueryWrapper<GoodsCategoryRule> lqw = new LambdaQueryWrapper<>(param);
PageUtil.startPage();
List<GoodsCategoryRule> list = goodsCategoryRuleService.list(lqw);
return R.byPageHelperList(list);
}
/**
* ID查询
* @param id
* @return
*/
@GetMapping("/getById/{id}")
@SysLog(module = SystemModule.GOODS, title = "品牌规则", biz = BizType.QUERY)
public R<GoodsCategoryRule> getById(@PathVariable("id") String id){
GoodsCategoryRule goodsCategoryRule = goodsCategoryRuleService.getById(id);
return R.ok(goodsCategoryRule);
}
/**
* 更新
* @param param
* @return
*/
@PostMapping("/updateById")
@SysLog(module = SystemModule.GOODS, title = "品牌规则", biz = BizType.UPDATE)
public R<?> updateById(@RequestBody @Valid GoodsCategoryRuleBo param){
goodsCategoryRuleService.modify(param);
return R.ok();
}
/**
* 新增
* @param param
* @return
*/
@PostMapping("/save")
@SysLog(module = SystemModule.GOODS, title = "品牌规则", biz = BizType.INSERT)
public R<?> save(@RequestBody @Valid GoodsCategoryRuleBo param){
goodsCategoryRuleService.modify(param);
return R.ok();
}
/**
* 删除
* @param ids
* @return
*/
@DeleteMapping("/deleteById/{ids}")
@SysLog(module = SystemModule.GOODS, title = "品牌规则", biz = BizType.DELETE)
public R<?> deleteById(@PathVariable("ids") String ids){
List<Long> idsLong = StringUtils.splitIdLong(ids);
boolean result = goodsCategoryRuleService.removeByIds(idsLong);
return R.isTrue(result);
}
}

102
src/main/java/com/qs/serve/modules/goods/entity/GoodsCategoryRule.java

@ -0,0 +1,102 @@
package com.qs.serve.modules.goods.entity;
import java.io.Serializable;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotBlank;
/**
* 品牌规则 实体类
* @author YenHex
* @since 2023-09-18
*/
@Data
@TableName(value = "goods_category_rule",autoResultMap = true)
public class GoodsCategoryRule implements Serializable {
private static final long serialVersionUID = 1L;
/** id */
@TableId(type = IdType.AUTO)
private Long id;
/** 标题 */
@NotBlank(message = "标题不能为空")
@Length(max = 255,message = "标题长度不能超过255字")
private String label;
/** 品牌id */
@NotBlank(message = "品牌id不能为空")
private String[] brandIds;
/** 品牌名称 */
@NotBlank(message = "品牌名称不能为空")
private String[] brandNames;
/** 启用状态 */
@NotNull(message = "启用状态不能为空")
private Integer enableFlag;
/** 备注 */
@Length(max = 255,message = "备注长度不能超过255字")
private String remark;
/** 创建时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/** 最后更新时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@TableField(fill = FieldFill.UPDATE)
private LocalDateTime updateTime;
/** 所属租户 */
@JsonIgnore
@JsonProperty
private String tenantId;
/** 逻辑删除标记(0:显示;1:隐藏) */
@JsonIgnore
@JsonProperty
private String delFlag;
/** 创建人 */
@TableField(fill = FieldFill.INSERT)
private String createBy;
/** 更新人 */
@TableField(fill = FieldFill.UPDATE)
private String updateBy;
public static GoodsCategoryRule toNewObject(GoodsCategoryRule source){
GoodsCategoryRule categoryRule = new GoodsCategoryRule();
categoryRule.setId(source.getId());
categoryRule.setLabel(source.getLabel());
categoryRule.setBrandIds(source.getBrandIds());
categoryRule.setBrandNames(source.getBrandNames());
categoryRule.setEnableFlag(source.getEnableFlag());
categoryRule.setRemark(source.getRemark());
categoryRule.setCreateTime(source.getCreateTime());
categoryRule.setUpdateTime(source.getUpdateTime());
categoryRule.setTenantId(source.getTenantId());
categoryRule.setDelFlag(source.getDelFlag());
categoryRule.setCreateBy(source.getCreateBy());
categoryRule.setUpdateBy(source.getUpdateBy());
return categoryRule;
}
}

33
src/main/java/com/qs/serve/modules/goods/entity/bo/GoodsCategoryRuleBo.java

@ -0,0 +1,33 @@
package com.qs.serve.modules.goods.entity.bo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* @author YenHex
* @since 2023/9/18
*/
@Data
public class GoodsCategoryRuleBo {
/** id */
private Long id;
/** 标题 */
private String label;
/** 品牌id */
private String[] brandIds;
/** 启用状态 */
private Integer enableFlag;
/** 备注 */
private String remark;
}

14
src/main/java/com/qs/serve/modules/goods/mapper/GoodsCategoryRuleMapper.java

@ -0,0 +1,14 @@
package com.qs.serve.modules.goods.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qs.serve.modules.goods.entity.GoodsCategoryRule;
/**
* 品牌规则 Mapper
* @author YenHex
* @date 2023-09-18
*/
public interface GoodsCategoryRuleMapper extends BaseMapper<GoodsCategoryRule> {
}

17
src/main/java/com/qs/serve/modules/goods/service/GoodsCategoryRuleService.java

@ -0,0 +1,17 @@
package com.qs.serve.modules.goods.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qs.serve.modules.goods.entity.GoodsCategoryRule;
import com.qs.serve.modules.goods.entity.bo.GoodsCategoryRuleBo;
/**
* 品牌规则 服务接口
* @author YenHex
* @date 2023-09-18
*/
public interface GoodsCategoryRuleService extends IService<GoodsCategoryRule> {
GoodsCategoryRule modify(GoodsCategoryRuleBo goodsCategoryRuleBo);
}

55
src/main/java/com/qs/serve/modules/goods/service/impl/GoodsCategoryRuleServiceImpl.java

@ -0,0 +1,55 @@
package com.qs.serve.modules.goods.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qs.serve.common.util.CopierUtil;
import com.qs.serve.modules.goods.entity.GoodsCategory;
import com.qs.serve.modules.goods.entity.bo.GoodsCategoryRuleBo;
import com.qs.serve.modules.goods.mapper.GoodsCategoryMapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.qs.serve.modules.goods.entity.GoodsCategoryRule;
import com.qs.serve.modules.goods.service.GoodsCategoryRuleService;
import com.qs.serve.modules.goods.mapper.GoodsCategoryRuleMapper;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* 品牌规则 服务实现类
* @author YenHex
* @since 2023-09-18
*/
@Slf4j
@Service
@AllArgsConstructor
public class GoodsCategoryRuleServiceImpl extends ServiceImpl<GoodsCategoryRuleMapper,GoodsCategoryRule> implements GoodsCategoryRuleService {
private GoodsCategoryMapper goodsCategoryMapper;
@Override
public GoodsCategoryRule modify(GoodsCategoryRuleBo param) {
LambdaQueryWrapper<GoodsCategory> brandCategory = new LambdaQueryWrapper<>();
brandCategory.in(GoodsCategory::getId, Arrays.asList(param.getBrandIds()));
brandCategory.eq(GoodsCategory::getLevel,1);
List<GoodsCategory> categoryList = goodsCategoryMapper.selectList(brandCategory);
List<String> ids = new ArrayList<>();
List<String> names = new ArrayList<>();
for (GoodsCategory category : categoryList) {
ids.add(category.getId()+"");
names.add(category.getName());
}
GoodsCategoryRule entity = CopierUtil.copy(param,new GoodsCategoryRule());
entity.setBrandIds(ids.toArray(new String[ids.size()]));
entity.setBrandNames(names.toArray(new String[names.size()]));
if(param.getId()!=null){
this.updateById(entity);
}else {
this.save(entity);
}
return entity;
}
}

2
src/main/java/com/qs/serve/modules/pay/controller/PayPaymentController.java

@ -249,7 +249,7 @@ public class PayPaymentController {
* @param erpId
* @return
*/
@GetMapping("/cancel/{id}")
@RequestMapping(value = "/cancel/{id}",method = {RequestMethod.GET,RequestMethod.DELETE})
@SysLog(module = SystemModule.Payment, title = "取消支付", biz = BizType.DELETE)
@PreAuthorize("hasRole('pay:payment:cancel')")
public R<?> cancelById(@PathVariable("id") String erpId){

1
src/main/java/com/qs/serve/modules/tbs/service/impl/TbsBudgetChangeOperationServiceImpl.java

@ -96,6 +96,7 @@ public class TbsBudgetChangeOperationServiceImpl implements SeeYonOperationServi
return;
}
TbsBudget tbsBudget = budgetMapper.selectById(budgetChange.getBudgetId());
tbsBudget.setBudgetCode(budgetChange.getBudgetTitle());
if(budgetChange.getNewAttachIds()!=null&& budgetChange.getNewAttachIds().length>0){
tbsBudget.setAttachIds(budgetChange.getNewAttachIds());
budgetMapper.updateById(tbsBudget);

1
src/main/java/com/qs/serve/modules/vtb/controller/VtbVerificationController.java

@ -153,6 +153,7 @@ public class VtbVerificationController {
}
}
}
Collections.reverse(list);
return R.byPageHelperList(listObjectIds,list);
}

Loading…
Cancel
Save