| | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.consum.base.service.FinSysTenantService; |
| | | import com.consum.model.po.FinSysTenant; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | @Api(value = "仓库管理", tags = "仓库管理") |
| | | @RestController |
| | | @RequestMapping("/pc/base/warehouse") |
| | | @Slf4j |
| | | public class BaseWarehouseController extends BaseController { |
| | | |
| | | @Autowired |
| | | private BaseWarehouseService baseWarehouseService; |
| | | |
| | | @Autowired |
| | | private LWhGoodsService lWhGoodsService; |
| | | |
| | | @Autowired |
| | | private FinSysTenantService finSysTenantService; |
| | | |
| | | /** |
| | | * @Description 新增 |
| | |
| | | return ResponseValue.error("新增失败!"); |
| | | } |
| | | |
| | | // 供产品导数据临时用(可删) |
| | | public String add1(BaseWarehouseParam param) { |
| | | BaseWarehouseParam param2 = new BaseWarehouseParam(); |
| | | CommonUtil.copyProperties(param, param2); |
| | | param = param2; |
| | | |
| | | if (StringUtils.isEmpty(param.getWarehouseName())) { |
| | | return "仓库名称为空"; |
| | | } |
| | | Long agencyId = param.getAgencyId(); |
| | | BaseWarehouse baseWarehouse = new BaseWarehouse(); |
| | | baseWarehouse.setAgencyId(agencyId); |
| | | List<BaseWarehouse> select = baseWarehouseService.select(baseWarehouse); |
| | | if (!CollectionUtils.isEmpty(select)) { |
| | | return "该机构已有仓库不能继续新增!"; |
| | | } |
| | | int result = baseWarehouseService.add(param); |
| | | if (result > 0) { |
| | | return "1"; |
| | | } |
| | | return "新增失败!"; |
| | | } |
| | | |
| | | //供产品导数据临时用(可删) |
| | | //@PostMapping("/addCk") |
| | | public String addCk() { |
| | | int ok = 0; |
| | | int isNull = 0; |
| | | int bnxz = 0; |
| | | int err = 0; |
| | | // 查询所有的机构 |
| | | FinSysTenant finSysTenant = new FinSysTenant(); |
| | | List<FinSysTenant> finSysTenants = finSysTenantService.selectAll(finSysTenant); |
| | | for (FinSysTenant fst : finSysTenants) { |
| | | // 组装仓库数据 |
| | | BaseWarehouseParam baseWarehouseParam = new BaseWarehouseParam(); |
| | | baseWarehouseParam.setWarehouseName(fst.getName() + "仓库"); |
| | | baseWarehouseParam.setAdress(""); |
| | | baseWarehouseParam.setAgencyId(fst.getId()); |
| | | baseWarehouseParam.setClassificationCode("29"); |
| | | baseWarehouseParam.setStates(1); |
| | | // 调用原本的新增接口新增仓库 |
| | | String resSta = add1(baseWarehouseParam); |
| | | if("1".equals(resSta)){ |
| | | ok++; |
| | | }else if("仓库名称为空".equals(resSta)){ |
| | | isNull++; |
| | | }else if("该机构已有仓库不能继续新增!".equals(resSta)){ |
| | | bnxz++; |
| | | }else if("新增失败!".equals(resSta)){ |
| | | err++; |
| | | } |
| | | } |
| | | log.info("ok:"+ok); |
| | | log.info("isNull:"+isNull); |
| | | log.info("bnxz:"+bnxz); |
| | | log.info("err:"+err); |
| | | return "新增仓库..."+"##ok:"+ok+"##isNull:"+isNull+"##bnxz:"+bnxz+"##err:"+err; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description 仓库列表查询 |
| | | * @Author 卢庆阳 |