|
@@ -4,10 +4,14 @@ package com.ydtech.modules.esm.controller;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
import com.ydtech.core.page.PageRequest;
|
|
import com.ydtech.core.page.PageRequest;
|
|
|
import com.ydtech.core.page.PageResult;
|
|
import com.ydtech.core.page.PageResult;
|
|
|
|
|
+import com.ydtech.exception.SystemException;
|
|
|
import com.ydtech.modules.base.controller.BaseController;
|
|
import com.ydtech.modules.base.controller.BaseController;
|
|
|
import com.ydtech.modules.esm.model.EsmRetail;
|
|
import com.ydtech.modules.esm.model.EsmRetail;
|
|
|
|
|
+import com.ydtech.modules.esm.model.vo.EsmRetailVo;
|
|
|
import com.ydtech.modules.esm.service.EsmRetailService;
|
|
import com.ydtech.modules.esm.service.EsmRetailService;
|
|
|
import com.ydtech.utils.idgen.IdGenerate;
|
|
import com.ydtech.utils.idgen.IdGenerate;
|
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -17,6 +21,7 @@ import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
+@Api(tags = "分销设置")
|
|
|
@RestController
|
|
@RestController
|
|
|
@RequestMapping("/esmRetail")
|
|
@RequestMapping("/esmRetail")
|
|
|
public class EsmRetailController extends BaseController {
|
|
public class EsmRetailController extends BaseController {
|
|
@@ -78,6 +83,7 @@ public class EsmRetailController extends BaseController {
|
|
|
public HttpResult findPage(@RequestBody PageRequest pageRequest) {
|
|
public HttpResult findPage(@RequestBody PageRequest pageRequest) {
|
|
|
int pageNum = pageRequest.getPageNum();
|
|
int pageNum = pageRequest.getPageNum();
|
|
|
int pageSize = pageRequest.getPageSize();
|
|
int pageSize = pageRequest.getPageSize();
|
|
|
|
|
+ String source = PageRequest.getColumnFilterValue(pageRequest, "source"); //
|
|
|
String deptid = PageRequest.getColumnFilterValue(pageRequest, "deptid"); //
|
|
String deptid = PageRequest.getColumnFilterValue(pageRequest, "deptid"); //
|
|
|
String containsSubDept = PageRequest.getColumnFilterValue(pageRequest, "containsSubDept");
|
|
String containsSubDept = PageRequest.getColumnFilterValue(pageRequest, "containsSubDept");
|
|
|
String retailtype = PageRequest.getColumnFilterValue(pageRequest, "retailtype");
|
|
String retailtype = PageRequest.getColumnFilterValue(pageRequest, "retailtype");
|
|
@@ -85,21 +91,24 @@ public class EsmRetailController extends BaseController {
|
|
|
StringBuffer whereStr = new StringBuffer(" where 1=1");
|
|
StringBuffer whereStr = new StringBuffer(" where 1=1");
|
|
|
ArrayList array = new ArrayList();
|
|
ArrayList array = new ArrayList();
|
|
|
if ("1".equals(containsSubDept) && !StringUtils.isEmpty(deptid)) {
|
|
if ("1".equals(containsSubDept) && !StringUtils.isEmpty(deptid)) {
|
|
|
- whereStr.append(" and deptid like ?");
|
|
|
|
|
|
|
+ whereStr.append(" and t.deptid like ?");
|
|
|
array.add(deptid + "%");
|
|
array.add(deptid + "%");
|
|
|
} else if (!StringUtils.isEmpty(deptid)) {
|
|
} else if (!StringUtils.isEmpty(deptid)) {
|
|
|
- whereStr.append(" and deptid = ?");
|
|
|
|
|
|
|
+ whereStr.append(" and t.deptid = ?");
|
|
|
array.add(deptid);
|
|
array.add(deptid);
|
|
|
}
|
|
}
|
|
|
if (!StringUtils.isEmpty(retailtype)) {
|
|
if (!StringUtils.isEmpty(retailtype)) {
|
|
|
- whereStr.append(" and retailtype=?");
|
|
|
|
|
|
|
+ whereStr.append(" and t.retailtype=?");
|
|
|
array.add(retailtype);
|
|
array.add(retailtype);
|
|
|
}
|
|
}
|
|
|
if (!StringUtils.isEmpty(status)) {
|
|
if (!StringUtils.isEmpty(status)) {
|
|
|
- whereStr.append(" and status=?");
|
|
|
|
|
|
|
+ whereStr.append(" and t.status=?");
|
|
|
array.add(status);
|
|
array.add(status);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotBlank(source)) {
|
|
|
|
|
+ whereStr.append(" and dept.management_source=?");
|
|
|
|
|
+ array.add(source);
|
|
|
|
|
+ }
|
|
|
PageResult pageResult = esmRetailService.selectPaging(pageNum, pageSize, whereStr.toString(), array.toArray());
|
|
PageResult pageResult = esmRetailService.selectPaging(pageNum, pageSize, whereStr.toString(), array.toArray());
|
|
|
|
|
|
|
|
return HttpResult.ok(pageResult);
|
|
return HttpResult.ok(pageResult);
|
|
@@ -117,4 +126,28 @@ public class EsmRetailController extends BaseController {
|
|
|
|
|
|
|
|
return HttpResult.ok(esmRetail);
|
|
return HttpResult.ok(esmRetail);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @version
|
|
|
|
|
+ * @author: hxl
|
|
|
|
|
+ * @Date: 2024/9/18 11:43
|
|
|
|
|
+ * @Description: 批量设置分销比例
|
|
|
|
|
+ */
|
|
|
|
|
+ @ApiOperation("批量设置分销比例")
|
|
|
|
|
+ @PostMapping(value = "/batchSetData")
|
|
|
|
|
+ public HttpResult<Object> batchSetData(@RequestBody EsmRetailVo esmRetailVo) {
|
|
|
|
|
+ if(esmRetailVo.getIds() ==null || esmRetailVo.getIds().size()==0){
|
|
|
|
|
+ new SystemException("所选数据不能为空!!");
|
|
|
|
|
+ }
|
|
|
|
|
+ if(org.apache.commons.lang3.StringUtils.isBlank(esmRetailVo.getRetailLevel())){
|
|
|
|
|
+ new SystemException("分销方式不能为空!!");
|
|
|
|
|
+ }
|
|
|
|
|
+ try{
|
|
|
|
|
+ esmRetailService.batchSetData(esmRetailVo);
|
|
|
|
|
+ }catch(Exception e){
|
|
|
|
|
+ return HttpResult.error("设置失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ return HttpResult.ok("设置成功");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|