| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.KeyValVo; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.manager.controller.params.AsnOrderItemParams; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderItemService; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | |
| | |
| | | public R save(@RequestBody AsnOrderItem asnOrderItem) { |
| | | asnOrderItem.setCreateBy(getLoginUserId()); |
| | | asnOrderItem.setUpdateBy(getLoginUserId()); |
| | | // asnOrderItemService.getFieldsExtend |
| | | String code = SerialRuleUtils.generateRuleCode("sys_ans_order", asnOrderItem); |
| | | if (!Objects.isNull(code)) { |
| | | asnOrderItem.setAsnCode(code); |
| | | } |
| | | if (!asnOrderItemService.save(asnOrderItem)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | |
| | | ExcelUtil.build(ExcelUtil.create(asnOrderItemService.list(), AsnOrderItem.class), response); |
| | | } |
| | | |
| | | /** |
| | | * ASN单据明细导入 |
| | | * @param file |
| | | * @return |
| | | */ |
| | | @PostMapping("/asnOrder/import") |
| | | @ApiOperation("ASN导入接口") |
| | | @PreAuthorize("hasAuthority('manager:asnOrder:update')") |
| | | public R importExcel(@RequestParam(value = "file") MultipartFile file, HttpServletRequest request) throws Exception { |
| | | if (Objects.isNull(file)) { |
| | | throw new CoolException("文件不能为空!!"); |
| | | } |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | if (!Objects.isNull(request.getParameter("asnId"))) { |
| | | hashMap.put("asnId", request.getParameter("asnId")); |
| | | } |
| | | return asnOrderItemService.excelImport(file, hashMap); |
| | | } |
| | | |
| | | } |