物料后端和大屏接口
This commit is contained in:
parent
b16e42baf5
commit
9ec6f49fd9
|
|
@ -95,17 +95,21 @@ public class MaterialController extends BaseController {
|
||||||
// @PreAuthorize("@ss.hasPermi('system:material:edit')")
|
// @PreAuthorize("@ss.hasPermi('system:material:edit')")
|
||||||
@Log(title = "修改宣传物料信息", businessType = BusinessType.UPDATE)
|
@Log(title = "修改宣传物料信息", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/edit")
|
@PostMapping("/edit")
|
||||||
public AjaxResult edit(@RequestParam(value = "files",required = false) MultipartFile[] files,@RequestParam(value = "fileMsg") String fileMsg, @RequestParam(value = "params")String params) {
|
public AjaxResult edit(@RequestParam(value = "files",required = false) MultipartFile[] files,@RequestParam(value = "fileMsg",required = false) String fileMsg, @RequestParam(value = "params")String params) {
|
||||||
try {
|
try {
|
||||||
List<WebFileDto> listFile = FastJsonHelper.jsonArrStrToBeanList(fileMsg, WebFileDto.class);
|
List<WebFileDto> listFile = FastJsonHelper.jsonArrStrToBeanList(fileMsg, WebFileDto.class);
|
||||||
// 验证对应关系
|
// 验证对应关系
|
||||||
if (listFile != null && listFile.size() != files.length) {
|
if (listFile != null && files != null && listFile.size() != files.length) {
|
||||||
return error("文件信息与文件数量不匹配或文件缺失");
|
return error("文件信息与文件数量不匹配或文件缺失");
|
||||||
}
|
}
|
||||||
//先将数据对应关系处理
|
//先将数据对应关系处理
|
||||||
for (int i = 0; i < Objects.requireNonNull(listFile).size(); i++) {
|
if(listFile != null){
|
||||||
listFile.get(i).setFile(files[i]);
|
for (int i = 0; i < listFile.size(); i++) {
|
||||||
|
assert files != null;
|
||||||
|
listFile.get(i).setFile(files[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TbPromotionMaterial tbPromotionMaterial = FastJsonHelper.jsonStrToBean(params, TbPromotionMaterial.class);
|
TbPromotionMaterial tbPromotionMaterial = FastJsonHelper.jsonStrToBean(params, TbPromotionMaterial.class);
|
||||||
return toAjax(service.updateTbPromotionMaterial(tbPromotionMaterial,listFile));
|
return toAjax(service.updateTbPromotionMaterial(tbPromotionMaterial,listFile));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.bonus.business.service.SelectService;
|
||||||
import com.bonus.common.core.controller.BaseController;
|
import com.bonus.common.core.controller.BaseController;
|
||||||
import com.bonus.common.core.domain.AjaxResult;
|
import com.bonus.common.core.domain.AjaxResult;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
|
@ -28,7 +29,7 @@ public class SelectController extends BaseController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/selectProduct")
|
@PostMapping("/selectProduct")
|
||||||
public AjaxResult selectProduct(MapBeanPo po){
|
public AjaxResult selectProduct(@RequestBody MapBeanPo po){
|
||||||
try{
|
try{
|
||||||
return service.selectProduct(po);
|
return service.selectProduct(po);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ public class TbPromotionMaterialServiceImpl implements ITbPromotionMaterialServi
|
||||||
//将产品与物料关系存到另一张表
|
//将产品与物料关系存到另一张表
|
||||||
List<TbPromotionMaterial> split = tbPromotionMaterial.split(tbPromotionMaterial);
|
List<TbPromotionMaterial> split = tbPromotionMaterial.split(tbPromotionMaterial);
|
||||||
int n = mapper.insertMaterialProductRelevance(split);
|
int n = mapper.insertMaterialProductRelevance(split);
|
||||||
if(!listFiles.isEmpty()){
|
if(listFiles != null && !listFiles.isEmpty()){
|
||||||
//删除以前的附件
|
//删除以前的附件
|
||||||
if(tbPromotionMaterial.getDelIds() != null && !tbPromotionMaterial.getDelIds().isEmpty()){
|
if(tbPromotionMaterial.getDelIds() != null && !tbPromotionMaterial.getDelIds().isEmpty()){
|
||||||
String[] splitId = tbPromotionMaterial.getDelIds().split(",");
|
String[] splitId = tbPromotionMaterial.getDelIds().split(",");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue