选品广场接口

This commit is contained in:
kuang.yife 2023-01-15 16:52:14 +08:00
parent e2112b4a5f
commit fb6e657848
2 changed files with 31 additions and 23 deletions

View File

@ -113,12 +113,10 @@ public class CustomerSelectionController extends BaseController
*/ */
@PostMapping("/app/add") @PostMapping("/app/add")
@ResponseBody @ResponseBody
public AjaxResult appAddSave(@RequestBody List<CustomerSelection> customerSelection) public AjaxResult appAddSave(@RequestBody CustomerSelection customerSelection)
{ {
try { try {
if(!CollectionUtils.isEmpty(customerSelection)){ Customer customer = customerService.selectByCustomerId(customerSelection.getCustomerId());
CustomerSelection checkOne = customerSelection.get(0);
Customer customer = customerService.selectByCustomerId(checkOne.getCustomerId());
if(StringUtil.isEmpty(customer.getPhone())){ if(StringUtil.isEmpty(customer.getPhone())){
throw new BaseException("手机号为空,无法关联师傅!"); throw new BaseException("手机号为空,无法关联师傅!");
} }
@ -131,14 +129,12 @@ public class CustomerSelectionController extends BaseController
}else { }else {
workId = workList.get(0).getWorkerId(); workId = workList.get(0).getWorkerId();
} }
customerSelection.forEach(selection->{ customerSelection.getDeptCategoryIds().forEach(selection->{
selection.setWorkId(workId); customerSelection.setWorkId(workId);
customerSelectionService.insertCustomerSelection(selection); customerSelection.setDeptCategoryId(selection);
customerSelectionService.insertCustomerSelection(customerSelection);
}); });
return AjaxResult.success("新增成功"); return AjaxResult.success("新增成功");
}else {
return AjaxResult.error("不能一个都不选哦!");
}
}catch (Exception e){ }catch (Exception e){
return AjaxResult.error(e.getMessage()); return AjaxResult.error(e.getMessage());
} }

View File

@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import com.ghy.common.annotation.Excel; import com.ghy.common.annotation.Excel;
import com.ghy.common.core.domain.BaseEntity; import com.ghy.common.core.domain.BaseEntity;
import java.util.List;
/** /**
* 消费者选品对象 customer_selection * 消费者选品对象 customer_selection
* *
@ -34,10 +36,20 @@ public class CustomerSelection extends BaseEntity
@Excel(name = "分公司类目id") @Excel(name = "分公司类目id")
private Long deptCategoryId; private Long deptCategoryId;
private List<Long> deptCategoryIds;
/** 选品类型 1.选取 2.屏蔽 */ /** 选品类型 1.选取 2.屏蔽 */
@Excel(name = "选品类型 1.选取 2.屏蔽") @Excel(name = "选品类型 1.选取 2.屏蔽")
private Long selectionType; private Long selectionType;
public List<Long> getDeptCategoryIds() {
return deptCategoryIds;
}
public void setDeptCategoryIds(List<Long> deptCategoryIds) {
this.deptCategoryIds = deptCategoryIds;
}
public void setId(String id) public void setId(String id)
{ {
this.id = id; this.id = id;