更新代码
This commit is contained in:
parent
20b79ec1ca
commit
5da4d8e576
@ -1,16 +1,22 @@
|
||||
package cn.iocoder.yudao.module.company.controller.admin;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.common.CommonErrorCodeConstants;
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.company.entity.Company;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyRespVO;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyReqVO;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@ -20,11 +26,13 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import cn.iocoder.yudao.module.company.service.CompanyService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
@ -43,6 +51,11 @@ import java.util.Map;
|
||||
@Tag(name = "管理后台 - BASE 企业管理")
|
||||
@Validated
|
||||
public class CompanyController {
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private DeptApi deptApi;
|
||||
|
||||
@Autowired
|
||||
private CompanyService companyService;
|
||||
|
||||
@ -160,4 +173,22 @@ public class CompanyController {
|
||||
public CommonResult<List<Company>> getCompanyList(){
|
||||
return success(companyService.list());
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前登录用户的门店信息
|
||||
*
|
||||
* @author 小李
|
||||
* @date 15:41 2024/9/18
|
||||
**/
|
||||
@GetMapping("/now")
|
||||
@Operation(summary = "企业信息表 当前登录用户的")
|
||||
public CommonResult<?> getNowCompany(){
|
||||
Long deptId = SecurityFrameworkUtils.getLoginUserDeptId();
|
||||
DeptRespDTO dept = deptApi.getDept(deptId);
|
||||
// 这里可能出现查不到的情况,直接抛个系统错误先,不能影响后续操作
|
||||
if (ObjectUtil.isEmpty(dept)){
|
||||
throw exception(CommonErrorCodeConstants.SYSTEM_ERROR);
|
||||
}
|
||||
return success(companyService.getById(dept.getCorpId()));
|
||||
}
|
||||
}
|
@ -1,7 +1,12 @@
|
||||
package cn.iocoder.yudao.module.stockTransfer.controller.admin;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.stockTransfer.service.DlRepairStService;
|
||||
import cn.iocoder.yudao.module.stockTransfer.vo.DlRepairStRespVO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
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.RestController;
|
||||
|
||||
@ -21,60 +26,19 @@ public class DlRepairStController{
|
||||
@Resource
|
||||
private DlRepairStService dlRepairStService;
|
||||
|
||||
// /**
|
||||
// * 分页查询所有数据
|
||||
// *
|
||||
// * @param page 分页对象
|
||||
// * @param dlRepairSt 查询实体
|
||||
// * @return 所有数据
|
||||
// */
|
||||
// @GetMapping
|
||||
// public R selectAll(Page<DlRepairSt> page, DlRepairSt dlRepairSt) {
|
||||
// return success(this.dlRepairStService.page(page, new QueryWrapper<>(dlRepairSt)));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 通过主键查询单条数据
|
||||
// *
|
||||
// * @param id 主键
|
||||
// * @return 单条数据
|
||||
// */
|
||||
// @GetMapping("{id}")
|
||||
// public R selectOne(@PathVariable Serializable id) {
|
||||
// return success(this.dlRepairStService.getById(id));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 新增数据
|
||||
// *
|
||||
// * @param dlRepairSt 实体对象
|
||||
// * @return 新增结果
|
||||
// */
|
||||
// @PostMapping
|
||||
// public R insert(@RequestBody DlRepairSt dlRepairSt) {
|
||||
// return success(this.dlRepairStService.save(dlRepairSt));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 修改数据
|
||||
// *
|
||||
// * @param dlRepairSt 实体对象
|
||||
// * @return 修改结果
|
||||
// */
|
||||
// @PutMapping
|
||||
// public R update(@RequestBody DlRepairSt dlRepairSt) {
|
||||
// return success(this.dlRepairStService.updateById(dlRepairSt));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 删除数据
|
||||
// *
|
||||
// * @param idList 主键结合
|
||||
// * @return 删除结果
|
||||
// */
|
||||
// @DeleteMapping
|
||||
// public R delete(@RequestParam("idList") List<Long> idList) {
|
||||
// return success(this.dlRepairStService.removeByIds(idList));
|
||||
// }
|
||||
/**
|
||||
* 调拨单 新增
|
||||
*
|
||||
* @author 小李
|
||||
* @date 19:06 2024/9/18
|
||||
* @param repairStRespVO 新增对象
|
||||
**/
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "调拨单 新增")
|
||||
public CommonResult<?> createSt(@RequestBody DlRepairStRespVO repairStRespVO){
|
||||
dlRepairStService.createSt(repairStRespVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -91,4 +91,9 @@ public class DlRepairSt extends TenantBaseDO {
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 部门ID(system_dept表的ID)
|
||||
*/
|
||||
private Long deptId;
|
||||
}
|
@ -48,9 +48,4 @@ public class DlRepairSti extends TenantBaseDO {
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 部门ID(system_dept表的ID)
|
||||
*/
|
||||
private Long deptId;
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.stockTransfer.service;
|
||||
|
||||
import cn.iocoder.yudao.module.stockTransfer.entity.DlRepairSt;
|
||||
import cn.iocoder.yudao.module.stockTransfer.vo.DlRepairStRespVO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
@ -11,4 +12,12 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
**/
|
||||
public interface DlRepairStService extends IService<DlRepairSt> {
|
||||
|
||||
/**
|
||||
* 调拨单 新增
|
||||
*
|
||||
* @author 小李
|
||||
* @date 19:06 2024/9/18
|
||||
* @param repairStRespVO 新增对象
|
||||
**/
|
||||
void createSt(DlRepairStRespVO repairStRespVO);
|
||||
}
|
||||
|
@ -1,11 +1,21 @@
|
||||
package cn.iocoder.yudao.module.stockTransfer.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.iocoder.yudao.common.RepairErrorCodeConstants;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.stockTransfer.entity.DlRepairSt;
|
||||
import cn.iocoder.yudao.module.stockTransfer.service.DlRepairStiService;
|
||||
import cn.iocoder.yudao.module.stockTransfer.vo.DlRepairStRespVO;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import cn.iocoder.yudao.module.stockTransfer.service.DlRepairStService;
|
||||
import cn.iocoder.yudao.module.stockTransfer.mapper.DlRepairStMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* 针对表【dl_repair_st(调拨单)】的数据库操作Service实现
|
||||
*
|
||||
@ -16,6 +26,31 @@ import org.springframework.stereotype.Service;
|
||||
public class DlRepairStServiceImpl extends ServiceImpl<DlRepairStMapper, DlRepairSt>
|
||||
implements DlRepairStService {
|
||||
|
||||
@Resource
|
||||
private DlRepairStiService repairStiService;
|
||||
|
||||
/**
|
||||
* 调拨单 新增
|
||||
*
|
||||
* @param repairStRespVO 新增对象
|
||||
* @author 小李
|
||||
* @date 19:06 2024/9/18
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void createSt(DlRepairStRespVO repairStRespVO) {
|
||||
// 获取当前登录用户的部门ID
|
||||
Long deptId = SecurityFrameworkUtils.getLoginUserDeptId();
|
||||
repairStRespVO.setDeptId(deptId);
|
||||
// 新增调拨单
|
||||
baseMapper.insert(repairStRespVO);
|
||||
// 新增调拨单子表
|
||||
if (CollectionUtil.isEmpty(repairStRespVO.getGoodsList())) {
|
||||
throw exception(RepairErrorCodeConstants.GOODS_IS_EMPTY);
|
||||
}
|
||||
repairStRespVO.getGoodsList().forEach(item -> item.setStId(repairStRespVO.getId()));
|
||||
repairStiService.saveBatch(repairStRespVO.getGoodsList());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,8 +1,11 @@
|
||||
package cn.iocoder.yudao.module.stockTransfer.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.stockTransfer.entity.DlRepairSt;
|
||||
import cn.iocoder.yudao.module.stockTransfer.entity.DlRepairSti;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 调拨单 响应VO
|
||||
* @author 小李
|
||||
@ -10,4 +13,7 @@ import lombok.Data;
|
||||
**/
|
||||
@Data
|
||||
public class DlRepairStRespVO extends DlRepairSt {
|
||||
|
||||
// 商品列表
|
||||
private List<DlRepairSti> goodsList;
|
||||
}
|
||||
|
@ -5,20 +5,21 @@
|
||||
<mapper namespace="cn.iocoder.yudao.module.stockTransfer.mapper.DlRepairStMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.stockTransfer.entity.DlRepairSt">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="outCorpId" column="out_corp_id" jdbcType="VARCHAR"/>
|
||||
<result property="inCorpId" column="in_corp_id" jdbcType="VARCHAR"/>
|
||||
<result property="stNo" column="st_no" jdbcType="VARCHAR"/>
|
||||
<result property="userId" column="user_id" jdbcType="BIGINT"/>
|
||||
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
|
||||
<result property="itemCount" column="item_count" jdbcType="INTEGER"/>
|
||||
<result property="totalPrice" column="total_price" jdbcType="DECIMAL"/>
|
||||
<result property="discountPrice" column="discount_price" jdbcType="DECIMAL"/>
|
||||
<result property="thisCollection" column="this_collection" jdbcType="DECIMAL"/>
|
||||
<result property="thisDebt" column="this_debt" jdbcType="DECIMAL"/>
|
||||
<result property="stStatus" column="st_status" jdbcType="VARCHAR"/>
|
||||
<result property="stTime" column="st_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="outCorpId" column="out_corp_id" jdbcType="VARCHAR"/>
|
||||
<result property="inCorpId" column="in_corp_id" jdbcType="VARCHAR"/>
|
||||
<result property="stNo" column="st_no" jdbcType="VARCHAR"/>
|
||||
<result property="userId" column="user_id" jdbcType="BIGINT"/>
|
||||
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
|
||||
<result property="itemCount" column="item_count" jdbcType="INTEGER"/>
|
||||
<result property="totalPrice" column="total_price" jdbcType="DECIMAL"/>
|
||||
<result property="discountPrice" column="discount_price" jdbcType="DECIMAL"/>
|
||||
<result property="thisCollection" column="this_collection" jdbcType="DECIMAL"/>
|
||||
<result property="thisDebt" column="this_debt" jdbcType="DECIMAL"/>
|
||||
<result property="stStatus" column="st_status" jdbcType="VARCHAR"/>
|
||||
<result property="stTime" column="st_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="deptId" column="dept_id" jdbcType="BIGINT"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_SQL">
|
||||
@ -35,7 +36,8 @@
|
||||
this_debt,
|
||||
st_status,
|
||||
st_time,
|
||||
remark
|
||||
remark,
|
||||
dept_id
|
||||
from dl_repair_st st
|
||||
where st.deleted = '0'
|
||||
</sql>
|
||||
|
@ -11,7 +11,6 @@
|
||||
<result property="goodsCount" column="goods_count" jdbcType="INTEGER"/>
|
||||
<result property="goodsPrice" column="goods_price" jdbcType="DECIMAL"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
<result property="deptId" column="dept_id" jdbcType="BIGINT"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_SQL">
|
||||
@ -20,8 +19,7 @@
|
||||
goods_id,
|
||||
goods_count,
|
||||
goods_price,
|
||||
remark,
|
||||
dept_id
|
||||
remark
|
||||
from dl_repair_sti sti
|
||||
where sti.deleted = '0'
|
||||
</sql>
|
||||
|
Loading…
Reference in New Issue
Block a user