Compare commits
3 Commits
f69678e3ae
...
0af6c82df2
Author | SHA1 | Date |
---|---|---|
李永德 | 0af6c82df2 | 1 month ago |
李永德 | 4835266b92 | 1 month ago |
李永德 | 03dbf755f2 | 1 month ago |
22 changed files with 807 additions and 22 deletions
@ -0,0 +1,59 @@ |
|||
package org.nl.wms.basedata.master.interfaceback.controller; |
|||
|
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.TableDataInfo; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.modules.logging.annotation.Log; |
|||
import org.nl.wms.basedata.master.interfaceback.service.IInterfaceBackService; |
|||
import org.nl.wms.basedata.master.interfaceback.service.dao.InterfaceBack; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @Author: lyd |
|||
* @Date: 2024/10/15 |
|||
*/ |
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@RequestMapping("/api/interfaceback") |
|||
@Slf4j |
|||
public class InterfaceBackController { |
|||
@Autowired |
|||
private IInterfaceBackService interfaceBackService; |
|||
@GetMapping |
|||
@Log("查询接口回传设置") |
|||
//@SaCheckPermission("@el.check('interfaceback:list')")
|
|||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) { |
|||
return new ResponseEntity<>(TableDataInfo.build(interfaceBackService.queryAll(whereJson, page)), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增接口回传设置") |
|||
//@SaCheckPermission("@el.check('interfaceback:add')")
|
|||
public ResponseEntity<Object> create(@Validated @RequestBody InterfaceBack dto) { |
|||
interfaceBackService.create(dto); |
|||
return new ResponseEntity<>(HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改接口回传设置") |
|||
//@SaCheckPermission("@el.check('interfaceback:edit')")
|
|||
public ResponseEntity<Object> update(@Validated @RequestBody InterfaceBack dto) { |
|||
interfaceBackService.update(dto); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
@Log("删除接口回传设置") |
|||
//@SaCheckPermission("@el.check('interfaceback:del')")
|
|||
@DeleteMapping |
|||
public ResponseEntity<Object> delete(@RequestBody String[] ids) { |
|||
interfaceBackService.deleteAll(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
} |
@ -0,0 +1,4 @@ |
|||
/** |
|||
* 接口回传 |
|||
*/ |
|||
package org.nl.wms.basedata.master.interfaceback; |
@ -0,0 +1,57 @@ |
|||
package org.nl.wms.basedata.master.interfaceback.service; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.wms.basedata.master.interfaceback.service.dao.InterfaceBack; |
|||
import org.nl.wms.basedata.master.service.dto.InterfacebackDto; |
|||
import org.springframework.data.domain.Pageable; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 接口回传 |
|||
* @Author: lyd |
|||
* @Date: 2024/10/15 |
|||
*/ |
|||
public interface IInterfaceBackService extends IService<InterfaceBack> { |
|||
/** |
|||
* 查询数据分页 |
|||
* |
|||
* @param whereJson 条件 |
|||
* @param page 分页参数 |
|||
* @return Map<String, Object> |
|||
*/ |
|||
IPage<InterfaceBack> queryAll(Map whereJson, PageQuery page); |
|||
|
|||
/** |
|||
* 根据编码查询 |
|||
* |
|||
* @param code code |
|||
* @return Interfaceback |
|||
*/ |
|||
InterfaceBack findByCode(String code); |
|||
|
|||
|
|||
/** |
|||
* 创建 |
|||
* |
|||
* @param dto / |
|||
*/ |
|||
void create(InterfaceBack dto); |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param dto / |
|||
*/ |
|||
void update(InterfaceBack dto); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* |
|||
* @param ids / |
|||
*/ |
|||
void deleteAll(String[] ids); |
|||
} |
@ -0,0 +1,57 @@ |
|||
package org.nl.wms.basedata.master.interfaceback.service.dao; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author: lyd |
|||
* @Date: 2024/10/15 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("md_pb_interfaceback") |
|||
public class InterfaceBack { |
|||
/** 标识 */ |
|||
/** |
|||
* 防止精度丢失 |
|||
*/ |
|||
@TableId |
|||
private String interface_id; |
|||
|
|||
/** |
|||
* 类型 |
|||
*/ |
|||
private String interface_type; |
|||
|
|||
/** |
|||
* 接口名称 |
|||
*/ |
|||
private String interface_name; |
|||
|
|||
/** |
|||
* 接口描述 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 是否回传 |
|||
*/ |
|||
private String is_back; |
|||
|
|||
/** |
|||
* 业务说明 |
|||
*/ |
|||
private String business_comment; |
|||
|
|||
/** |
|||
* 业务说明 |
|||
*/ |
|||
private String product_area; |
|||
@TableField(exist = false) |
|||
private String[] product_areas; |
|||
} |
@ -0,0 +1,11 @@ |
|||
package org.nl.wms.basedata.master.interfaceback.service.dao.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.nl.wms.basedata.master.interfaceback.service.dao.InterfaceBack; |
|||
|
|||
/** |
|||
* @Author: lyd |
|||
* @Date: 2024/10/15 |
|||
*/ |
|||
public interface InterfaceBackMapper extends BaseMapper<InterfaceBack> { |
|||
} |
@ -0,0 +1,5 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="org.nl.wms.basedata.master.interfaceback.service.dao.mapper.InterfaceBackMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,87 @@ |
|||
package org.nl.wms.basedata.master.interfaceback.service.impl; |
|||
|
|||
import cn.hutool.core.map.MapUtil; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.modules.common.exception.BadRequestException; |
|||
import org.nl.wms.basedata.master.interfaceback.service.IInterfaceBackService; |
|||
import org.nl.wms.basedata.master.interfaceback.service.dao.InterfaceBack; |
|||
import org.nl.wms.basedata.master.interfaceback.service.dao.mapper.InterfaceBackMapper; |
|||
import org.nl.wms.basedata.master.service.dto.InterfacebackDto; |
|||
import org.nl.wms.basedata.master.standard.service.dao.ClassStandard; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @Author: lyd |
|||
* @Date: 2024/10/15 |
|||
*/ |
|||
@Service |
|||
public class InterfaceBackServiceImpl extends ServiceImpl<InterfaceBackMapper, InterfaceBack> implements IInterfaceBackService { |
|||
@Autowired |
|||
private InterfaceBackMapper interfaceBackMapper; |
|||
@Override |
|||
public IPage<InterfaceBack> queryAll(Map whereJson, PageQuery page) { |
|||
String interface_name = MapUtil.getStr(whereJson, "interface_name"); |
|||
LambdaQueryWrapper<InterfaceBack> lam = new QueryWrapper<InterfaceBack>().lambda(); |
|||
lam.like(ObjectUtil.isNotEmpty(interface_name), InterfaceBack::getInterface_name, interface_name); |
|||
IPage<InterfaceBack> pages = new Page<>(page.getPage() + 1, page.getSize()); |
|||
interfaceBackMapper.selectPage(pages, lam); |
|||
pages.getRecords().forEach(ib -> { |
|||
if (ObjectUtil.isEmpty(ib.getProduct_area())) { |
|||
return; |
|||
} |
|||
String product_area = (ib.getProduct_area().replace("[", "").replace("]", "")).replaceAll("\\\"", ""); |
|||
ib.setProduct_areas(product_area.split(",")); |
|||
}); |
|||
return pages; |
|||
} |
|||
@Override |
|||
public InterfaceBack findByCode(String code) { |
|||
LambdaQueryWrapper<InterfaceBack> lam = new LambdaQueryWrapper<>(); |
|||
lam.eq(InterfaceBack::getInterface_name, code); |
|||
InterfaceBack one = getOne(lam); |
|||
if (ObjectUtil.isNotEmpty(one.getProduct_area())) { |
|||
String product_area = (one.getProduct_area().replace("[", "").replace("]", "")).replaceAll("\\\"", ""); |
|||
one.setProduct_areas(product_area.split(",")); |
|||
} |
|||
return one; |
|||
} |
|||
|
|||
@Override |
|||
public void create(InterfaceBack dto) { |
|||
dto.setInterface_id(IdUtil.getSnowflake(1, 1).nextIdStr()); |
|||
String result = Arrays.toString(dto.getProduct_areas()); |
|||
result = result.replaceAll(" ", ""); |
|||
dto.setProduct_area(result); |
|||
interfaceBackMapper.insert(dto); |
|||
} |
|||
|
|||
@Override |
|||
public void update(InterfaceBack dto) { |
|||
InterfaceBack entity = this.getById(dto.getInterface_id()); |
|||
if (entity == null) { |
|||
throw new BadRequestException("被删除或无权限,操作失败!"); |
|||
} |
|||
String result = Arrays.toString(dto.getProduct_areas()); |
|||
result = result.replaceAll(" ", ""); |
|||
dto.setProduct_area(result); |
|||
interfaceBackMapper.updateById(dto); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteAll(String[] ids) { |
|||
removeByIds(Arrays.asList(ids)); |
|||
} |
|||
} |
@ -0,0 +1,68 @@ |
|||
package org.nl.wms.basedata.master.transport.controller; |
|||
|
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.TableDataInfo; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.modules.logging.annotation.Log; |
|||
import org.nl.wms.basedata.master.transport.service.ITransportationBaseService; |
|||
import org.nl.wms.basedata.master.transport.service.dao.TransportationBase; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 运输公司信息管理 |
|||
* @Author: lyd |
|||
* @Date: 2024/10/15 |
|||
*/ |
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@RequestMapping("/api/transportationbase") |
|||
@Slf4j |
|||
public class TransportationBaseController { |
|||
@Autowired |
|||
private ITransportationBaseService transportationbaseService; |
|||
|
|||
@GetMapping |
|||
@Log(value = "查询运输公司基本信息", isAddLogTable = false |
|||
) |
|||
//@SaCheckPermission("@el.check('transportationbase:list')")
|
|||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) { |
|||
return new ResponseEntity<>(TableDataInfo.build(transportationbaseService.queryAll(whereJson, page)), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增运输公司基本信息") |
|||
//@SaCheckPermission("@el.check('transportationbase:add')")
|
|||
public ResponseEntity<Object> create(@Validated @RequestBody TransportationBase dto) { |
|||
transportationbaseService.create(dto); |
|||
return new ResponseEntity<>(HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改运输公司基本信息") |
|||
//@SaCheckPermission("@el.check('transportationbase:edit')")
|
|||
public ResponseEntity<Object> update(@Validated @RequestBody TransportationBase dto) { |
|||
transportationbaseService.update(dto); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
@Log("删除运输公司基本信息") |
|||
//@SaCheckPermission("@el.check('transportationbase:del')")
|
|||
@DeleteMapping |
|||
public ResponseEntity<Object> delete(@RequestBody String[] ids) { |
|||
transportationbaseService.deleteAll(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@Log(value = "运输公司基本信息下拉框", isAddLogTable = false) |
|||
@PostMapping("/getTransporta") |
|||
public ResponseEntity<Object> getTransporta() { |
|||
return new ResponseEntity<>(transportationbaseService.getTransporta(), HttpStatus.OK); |
|||
} |
|||
} |
@ -0,0 +1,4 @@ |
|||
/** |
|||
* 运输公司基本信息相关 |
|||
*/ |
|||
package org.nl.wms.basedata.master.transport; |
@ -0,0 +1,62 @@ |
|||
package org.nl.wms.basedata.master.transport.service; |
|||
|
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.wms.basedata.master.service.dto.TransportationbaseDto; |
|||
import org.nl.wms.basedata.master.transport.service.dao.TransportationBase; |
|||
import org.nl.wms.pda.common.SelectVo; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @Author: lyd |
|||
* @Date: 2024/10/15 |
|||
*/ |
|||
public interface ITransportationBaseService extends IService<TransportationBase> { |
|||
/** |
|||
* 查询数据分页 |
|||
* |
|||
* @param whereJson 条件 |
|||
* @param page 分页参数 |
|||
* @return TransportationBase |
|||
*/ |
|||
IPage<TransportationBase> queryAll(Map whereJson, PageQuery page); |
|||
|
|||
/** |
|||
* 根据编码查询 |
|||
* <p>必须唯一,否则报错</p> |
|||
* @param code code |
|||
* @return Transportationbase |
|||
*/ |
|||
TransportationBase findByCode(String code); |
|||
|
|||
|
|||
/** |
|||
* 创建 |
|||
* |
|||
* @param dto / |
|||
*/ |
|||
void create(TransportationBase dto); |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param dto / |
|||
*/ |
|||
void update(TransportationBase dto); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* |
|||
* @param ids / |
|||
*/ |
|||
void deleteAll(String[] ids); |
|||
|
|||
/** |
|||
* 获取下拉框 |
|||
*/ |
|||
List<SelectVo> getTransporta(); |
|||
} |
@ -0,0 +1,47 @@ |
|||
package org.nl.wms.basedata.master.transport.service.dao; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* @Author: lyd |
|||
* @Date: 2024/10/15 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("md_cs_transportationbase") |
|||
public class TransportationBase { |
|||
@TableId |
|||
private String cust_id; |
|||
private String cust_code; |
|||
private String cust_name; |
|||
private String cust_simple_name; |
|||
private String country; |
|||
private String state; |
|||
private String city; |
|||
private String faxnumber; |
|||
private String webSite; |
|||
private String jurid_name; |
|||
private String tax_no; |
|||
private String register_no; |
|||
private String manage_lice_no; |
|||
private String busi_char_name; |
|||
private String area_id; |
|||
private String zip_code; |
|||
private String corp_tele_no; |
|||
private String corp_address; |
|||
private String create_id; |
|||
private String create_name; |
|||
private String create_time; |
|||
private String update_id; |
|||
private String update_name; |
|||
private String update_time; |
|||
private Boolean is_used_time; |
|||
private Boolean is_used; |
|||
private Boolean is_delete; |
|||
private String ext_id; |
|||
private String remark; |
|||
|
|||
} |
@ -0,0 +1,12 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="org.nl.wms.basedata.master.transport.service.dao.mapper.TransportationBaseMapper"> |
|||
|
|||
<select id="getTransportSelects" resultType="org.nl.wms.pda.common.SelectVo"> |
|||
SELECT cust_code AS `value`, |
|||
cust_name AS label |
|||
FROM MD_CS_TransportationBase |
|||
WHERE is_delete = '0' |
|||
AND is_used = '1' |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,15 @@ |
|||
package org.nl.wms.basedata.master.transport.service.dao.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.nl.wms.basedata.master.transport.service.dao.TransportationBase; |
|||
import org.nl.wms.pda.common.SelectVo; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author: lyd |
|||
* @Date: 2024/10/15 |
|||
*/ |
|||
public interface TransportationBaseMapper extends BaseMapper<TransportationBase> { |
|||
List<SelectVo> getTransportSelects(); |
|||
} |
@ -0,0 +1,163 @@ |
|||
package org.nl.wms.basedata.master.transport.service.dto; |
|||
|
|||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
|||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author Liuxy |
|||
* @description / |
|||
* @date 2022-11-10 |
|||
**/ |
|||
@Data |
|||
public class TransportationBaseDto implements Serializable { |
|||
|
|||
/** 物流公司标识 */ |
|||
/** |
|||
* 防止精度丢失 |
|||
*/ |
|||
@JsonSerialize(using = ToStringSerializer.class) |
|||
private Long cust_id; |
|||
|
|||
/** |
|||
* 物流公司编码 |
|||
*/ |
|||
private String cust_code; |
|||
|
|||
/** |
|||
* 物流公司名称 |
|||
*/ |
|||
private String cust_name; |
|||
|
|||
/** |
|||
* 物流公司简称 |
|||
*/ |
|||
private String cust_simple_name; |
|||
|
|||
/** |
|||
* 国家 |
|||
*/ |
|||
private String country; |
|||
|
|||
/** |
|||
* 省份 |
|||
*/ |
|||
private String state; |
|||
|
|||
/** |
|||
* 城市 |
|||
*/ |
|||
private String city; |
|||
|
|||
/** |
|||
* 传真 |
|||
*/ |
|||
private String faxnumber; |
|||
|
|||
/** |
|||
* 邮箱 |
|||
*/ |
|||
private String webSite; |
|||
|
|||
/** |
|||
* 法人代表 |
|||
*/ |
|||
private String jurid_name; |
|||
|
|||
/** |
|||
* 税务登记号 |
|||
*/ |
|||
private String tax_no; |
|||
|
|||
/** |
|||
* 工商注册号 |
|||
*/ |
|||
private String register_no; |
|||
|
|||
/** |
|||
* 经营许可证号 |
|||
*/ |
|||
private String manage_lice_no; |
|||
|
|||
/** |
|||
* 营业执照 |
|||
*/ |
|||
private String busi_char_name; |
|||
|
|||
/** |
|||
* 行政区划 |
|||
*/ |
|||
private Long area_id; |
|||
|
|||
/** |
|||
* 邮政编码 |
|||
*/ |
|||
private String zip_code; |
|||
|
|||
/** |
|||
* 公司电话 |
|||
*/ |
|||
private String corp_tele_no; |
|||
|
|||
/** |
|||
* 公司地址 |
|||
*/ |
|||
private String corp_address; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String create_id; |
|||
|
|||
/** |
|||
* 创建人姓名 |
|||
*/ |
|||
private String create_name; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private String create_time; |
|||
|
|||
/** |
|||
* 修改人 |
|||
*/ |
|||
private String update_optid; |
|||
|
|||
/** |
|||
* 修改人姓名 |
|||
*/ |
|||
private String update_optname; |
|||
|
|||
/** |
|||
* 修改时间 |
|||
*/ |
|||
private String update_time; |
|||
|
|||
/** |
|||
* 启用时间 |
|||
*/ |
|||
private String is_used_time; |
|||
|
|||
/** |
|||
* 是否启用 |
|||
*/ |
|||
private String is_used; |
|||
|
|||
/** |
|||
* 是否删除 |
|||
*/ |
|||
private String is_delete; |
|||
|
|||
/** |
|||
* 外部标识 |
|||
*/ |
|||
private String ext_id; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
} |
@ -0,0 +1,105 @@ |
|||
package org.nl.wms.basedata.master.transport.service.impl; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.map.MapUtil; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.modules.common.exception.BadRequestException; |
|||
import org.nl.wms.basedata.master.service.dto.TransportationbaseDto; |
|||
import org.nl.wms.basedata.master.transport.service.ITransportationBaseService; |
|||
import org.nl.wms.basedata.master.transport.service.dao.TransportationBase; |
|||
import org.nl.wms.basedata.master.transport.service.dao.mapper.TransportationBaseMapper; |
|||
import org.nl.wms.pda.common.SelectVo; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @Author: lyd |
|||
* @Date: 2024/10/15 |
|||
*/ |
|||
@Service |
|||
public class TransportationBaseServiceImpl extends ServiceImpl<TransportationBaseMapper, TransportationBase> implements ITransportationBaseService { |
|||
@Autowired |
|||
private TransportationBaseMapper transportationBaseMapper; |
|||
@Override |
|||
public IPage<TransportationBase> queryAll(Map whereJson, PageQuery page) { |
|||
String custCode = MapUtil.getStr(whereJson, "cust_code"); |
|||
String custName = MapUtil.getStr(whereJson, "cust_name"); |
|||
String isUsed = MapUtil.getStr(whereJson, "is_used"); |
|||
LambdaQueryWrapper<TransportationBase> lam = new QueryWrapper<TransportationBase>().lambda(); |
|||
lam.like(ObjectUtil.isNotEmpty(custCode), TransportationBase::getCust_code, custCode) |
|||
.like(ObjectUtil.isNotEmpty(custName), TransportationBase::getCust_name, custName) |
|||
.eq(ObjectUtil.isNotEmpty(isUsed), TransportationBase::getIs_used, "1".equals(isUsed)); |
|||
IPage<TransportationBase> pages = new Page<>(page.getPage() + 1, page.getSize()); |
|||
transportationBaseMapper.selectPage(pages, lam); |
|||
return pages; |
|||
} |
|||
|
|||
@Override |
|||
public TransportationBase findByCode(String code) { |
|||
LambdaQueryWrapper<TransportationBase> lam = new QueryWrapper<TransportationBase>().lambda(); |
|||
lam.eq(TransportationBase::getCust_code, code); |
|||
return getOne(lam); |
|||
} |
|||
|
|||
@Override |
|||
public void create(TransportationBase dto) { |
|||
TransportationBase oneTran = findByCode(dto.getCust_code()); |
|||
if (ObjectUtil.isNotEmpty(oneTran)) { |
|||
throw new BadRequestException("此编码已存在"); |
|||
} |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
|
|||
dto.setCust_id(IdUtil.getSnowflake(1, 1).nextIdStr()); |
|||
dto.setCreate_id(currentUserId); |
|||
dto.setCreate_name(nickName); |
|||
dto.setUpdate_id(currentUserId); |
|||
dto.setUpdate_name(nickName); |
|||
dto.setUpdate_time(now); |
|||
dto.setCreate_time(now); |
|||
|
|||
transportationBaseMapper.insert(dto); |
|||
} |
|||
|
|||
@Override |
|||
public void update(TransportationBase dto) { |
|||
TransportationBase oneTran = getById(dto.getCust_id()); |
|||
if (oneTran == null) { |
|||
throw new BadRequestException("被删除或无权限,操作失败!"); |
|||
} |
|||
|
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
|
|||
String now = DateUtil.now(); |
|||
dto.setUpdate_time(now); |
|||
dto.setUpdate_id(currentUserId); |
|||
dto.setUpdate_name(nickName); |
|||
transportationBaseMapper.updateById(dto); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteAll(String[] ids) { |
|||
this.removeByIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
public List<SelectVo> getTransporta() { |
|||
return transportationBaseMapper.getTransportSelects(); |
|||
} |
|||
} |
@ -0,0 +1,14 @@ |
|||
package org.nl.wms.pda.common; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 手持下拉框实体 |
|||
* @Author: lyd |
|||
* @Date: 2024/10/15 |
|||
*/ |
|||
@Data |
|||
public class SelectVo { |
|||
private String value; |
|||
private String label; |
|||
} |
@ -0,0 +1,4 @@ |
|||
/** |
|||
* 手持通用类 |
|||
*/ |
|||
package org.nl.wms.pda.common; |
Loading…
Reference in new issue