add:页面
This commit is contained in:
@@ -5,6 +5,7 @@ import lombok.Getter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* s
|
||||
@@ -16,11 +17,24 @@ public enum QueryTEnum {
|
||||
//
|
||||
EQ((q, k, v) -> { q.eq(k[0],v); }),
|
||||
IN((q, key, o) -> { if (o instanceof Collection){ q.in(key[0],(Collection) o); } }),
|
||||
LK((q, keys, o) -> { for (String key : keys) { q.like(key,o); } }),
|
||||
LK((queryWrapper, keys, val) -> {
|
||||
queryWrapper.nested((Consumer<QueryWrapper>) query -> {
|
||||
query.like(keys[0], val);
|
||||
for (int i = 1; i < keys.length; i++) {
|
||||
query.or(true).like(keys[i], val);
|
||||
}
|
||||
});
|
||||
}),
|
||||
LE((q, k, v) -> { q.le(k[0],v); }),
|
||||
GE((q, k, v) -> { q.ge(k[0],v); }),
|
||||
BY((q, k, v) -> { q.orderByDesc(k[0],v); }),
|
||||
NO((q, k, v) -> { q.isNull(k[0]); }),
|
||||
LT((q, k, v) -> { q.lt(k[0],v); }),
|
||||
BT((q, k, v) -> { q.between(k[0],((Object[])v)[0],((Object[])v)[1]); }),
|
||||
LASTSQL((q, k, o) -> {
|
||||
q.eq("1","1");
|
||||
q.last(String.valueOf(k[0]));
|
||||
}),
|
||||
OREQ((q, k, v) -> { if (StringUtils.isBlank((String)v)){ q.isNull(k[0]); }else { q.eq(k[0],v); } });
|
||||
|
||||
private LConsumer<QueryWrapper,String[], Object> doP;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.boge.modules.car.service.impl;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.Map;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -18,12 +19,14 @@ public class CarServiceImpl extends ServiceImpl<CarDao, CarEntity> implements Ca
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
QueryWrapper<CarEntity> query = new QueryWrapper<>();
|
||||
if (params.get("key") != null){
|
||||
query.like("car_name",params.get("key"));
|
||||
}
|
||||
IPage<CarEntity> page = this.page(
|
||||
new Query<CarEntity>().getPage(params),
|
||||
new QueryWrapper<CarEntity>()
|
||||
new Query<CarEntity>().getPage(params),query
|
||||
);
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ package com.boge.modules.client.controller;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.boge.common.query.PageQuery;
|
||||
import com.boge.modules.client.entity.ClientQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -18,7 +21,7 @@ import com.boge.common.utils.R;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* @author ls
|
||||
* @email dengpbs@163.com
|
||||
@@ -35,10 +38,9 @@ public class ClientController {
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
//@RequiresPermissions("client:client:list")
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
PageUtils page = clientService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
public R list(PageQuery page, ClientQuery query){
|
||||
Page<ClientEntity> result = clientService.page(page.build(), query.build());
|
||||
return R.ok().put("page", new PageUtils(result));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.boge.modules.client.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.boge.common.query.BaseQuery;
|
||||
import com.boge.common.query.QParam;
|
||||
import com.boge.common.query.QueryTEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 公司
|
||||
*
|
||||
* @author ls
|
||||
* @email dengpbs@163.com
|
||||
* @date 2025-02-26 19:46:19
|
||||
*/
|
||||
@Data
|
||||
public class ClientQuery extends BaseQuery<ClientEntity> {
|
||||
|
||||
private String key;
|
||||
|
||||
|
||||
@Override
|
||||
public void paramMapping() {
|
||||
super.doP.put("key", QParam.builder().k(new String[]{"client_name"}).type(QueryTEnum.LK).build());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,4 +26,4 @@ public class ClientServiceImpl extends ServiceImpl<ClientDao, ClientEntity> impl
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package com.boge.modules.contract.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.boge.common.query.PageQuery;
|
||||
import com.boge.common.utils.PageUtils;
|
||||
import com.boge.common.utils.R;
|
||||
import com.boge.modules.client.entity.ClientQuery;
|
||||
import com.boge.modules.contract.entity.ContractEntity;
|
||||
import com.boge.modules.contract.entity.ContractQuery;
|
||||
import com.boge.modules.contract.service.ContractService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -30,10 +34,9 @@ public class ContractController {
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
//@RequiresPermissions("flow:contract:list")
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
PageUtils page = contractService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
public R list(PageQuery page, ContractQuery query){
|
||||
Page<ContractEntity> entityPage = contractService.page(page.build(), query.build());
|
||||
return R.ok().put("page", new PageUtils(entityPage));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.boge.modules.contract.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.boge.common.query.BaseQuery;
|
||||
import com.boge.common.query.QParam;
|
||||
import com.boge.common.query.QueryTEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author ls
|
||||
* @email dengpbs@163.com
|
||||
* @date 2025-02-26 19:33:35
|
||||
*/
|
||||
@Data
|
||||
public class ContractQuery extends BaseQuery<ContractEntity> {
|
||||
private Integer isValidity;
|
||||
private Integer isAcceptance;
|
||||
private Integer contractType;
|
||||
private String contractNumber;
|
||||
private String clientName;
|
||||
|
||||
@Override
|
||||
public void paramMapping() {
|
||||
super.doP.put("contractNumber", QParam.builder().k(new String[]{"contract_number"}).type(QueryTEnum.LK).build());
|
||||
super.doP.put("clientName", QParam.builder().k(new String[]{"client_name"}).type(QueryTEnum.LK).build());
|
||||
super.doP.put("startTime", QParam.builder().k(new String[]{"acceptance_time"}).type(QueryTEnum.LT).build());
|
||||
super.doP.put("endTime", QParam.builder().k(new String[]{"acceptance_time"}).type(QueryTEnum.LE).build());
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.boge.common.query.PageQuery;
|
||||
import com.boge.modules.dict.dao.Dict;
|
||||
import com.boge.modules.dict.dto.DictQuery;
|
||||
import liquibase.pro.packaged.I;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
@@ -85,4 +86,10 @@ public interface ISysDictService extends IService<Dict> {
|
||||
* @return
|
||||
*/
|
||||
List<Dict> queryAll();
|
||||
|
||||
/**
|
||||
* 查询label,value
|
||||
* @return
|
||||
*/
|
||||
Map<String, String> getAllLable();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.boge.common.exception.RRException;
|
||||
import com.boge.common.query.MapOf;
|
||||
import com.boge.common.query.PageQuery;
|
||||
import com.boge.common.utils.ShiroUtils;
|
||||
import com.boge.modules.dict.dao.Dict;
|
||||
@@ -17,14 +18,12 @@ import com.boge.modules.dict.dao.mapper.SysDictMapper;
|
||||
import com.boge.modules.dict.dto.DictQuery;
|
||||
import com.boge.modules.dict.service.ISysDictService;
|
||||
import com.boge.modules.sys.entity.SysUserEntity;
|
||||
import liquibase.pro.packaged.S;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -202,4 +201,13 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
||||
.groupBy(Dict::getCode, Dict::getName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getAllLable() {
|
||||
List<Dict> dicts = sysDictMapper.selectList(new QueryWrapper<Dict>().select("value", "label"));
|
||||
Map<String, String> result = new HashMap<>();
|
||||
for (Dict dict : dicts) {
|
||||
result.put(dict.getLabel(),dict.getValue());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,32 @@
|
||||
package com.boge.modules.material.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.boge.common.query.PageQuery;
|
||||
import com.boge.modules.dept.util.PageUtil;
|
||||
import com.boge.modules.material.dao.MaterialQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.boge.modules.material.entity.MaterialEntity;
|
||||
import com.boge.modules.material.service.MaterialService;
|
||||
import com.boge.common.utils.PageUtils;
|
||||
import com.boge.common.utils.R;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* @author ls
|
||||
* @email dengpbs@163.com
|
||||
@@ -35,13 +43,11 @@ public class MaterialController {
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
//@RequiresPermissions("material:material:list")
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
PageUtils page = materialService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
public R list(PageQuery page, MaterialQuery query){
|
||||
Page<MaterialEntity> entityPage = materialService.page(page.build(), query.build());
|
||||
return R.ok().put("page", new PageUtils(entityPage));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@@ -64,6 +70,20 @@ public class MaterialController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/importExcel")
|
||||
//@RequiresPermissions("material:material:save")
|
||||
public R batchSave(@RequestParam("file") MultipartFile file){
|
||||
List<String> list = materialService.importMarial(file);
|
||||
if (!CollectionUtils.isEmpty(list)){
|
||||
return R.error(list.stream().collect(Collectors.joining(",")));
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
package com.boge.modules.material.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.boge.common.base.TableDataInfo;
|
||||
import com.boge.common.query.PageQuery;
|
||||
import com.boge.common.utils.R;
|
||||
import com.boge.common.utils.ShiroUtils;
|
||||
import com.boge.modules.material.dao.MaterialPriceQuery;
|
||||
import com.boge.modules.material.entity.MaterialEntity;
|
||||
import com.boge.modules.material.entity.MaterialPriceEntity;
|
||||
import com.boge.modules.material.service.MaterialPriceService;
|
||||
import com.boge.modules.material.service.MaterialService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author ls
|
||||
* @email dengpbs@163.com
|
||||
* @date 2025-02-26 20:06:39
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("materialPrice")
|
||||
public class MaterialPriceController {
|
||||
@Autowired
|
||||
private MaterialService materialService;
|
||||
@Autowired
|
||||
private MaterialPriceService materialPriceService;
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/info")
|
||||
//@RequiresPermissions("material:material:info")
|
||||
public R info(PageQuery page, MaterialPriceQuery query){
|
||||
page.setSort("id,desc");
|
||||
Page<MaterialPriceEntity> entityPage = materialPriceService.page(page.build(), query.build());
|
||||
return R.ok().put("data",entityPage.getRecords())
|
||||
.put("page",page.getPage())
|
||||
.put("size",page.getSize()).put("total",entityPage.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
//@RequiresPermissions("material:material:save")
|
||||
public R save(@RequestBody MaterialPriceEntity material){
|
||||
material.setCreateTime(new Date());
|
||||
material.setCreateName(ShiroUtils.getUserEntity().getNickname());
|
||||
materialPriceService.save(material);
|
||||
return R.ok();
|
||||
}
|
||||
/**
|
||||
* 价格变动
|
||||
*/
|
||||
@RequestMapping("/use")
|
||||
//@RequiresPermissions("material:material:save")
|
||||
public R use(@RequestBody MaterialPriceEntity price){
|
||||
materialService.update(new UpdateWrapper<MaterialEntity>()
|
||||
.set("cost_price",price.getCostPrice())
|
||||
.set("sale_price",price.getSalePrice())
|
||||
.set("update_time",new Date())
|
||||
.set("update_Name", ShiroUtils.getUserEntity().getNickname())
|
||||
.set("sale_price",price.getSalePrice())
|
||||
.eq("material_code",price.getMaterialCode()));
|
||||
return R.ok();
|
||||
}
|
||||
/**
|
||||
* 批量导入
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/importExcel")
|
||||
//@RequiresPermissions("material:material:save")
|
||||
public R batchSave(@RequestParam("file") MultipartFile file){
|
||||
List<String> list = materialService.importMarial(file);
|
||||
if (!CollectionUtils.isEmpty(list)){
|
||||
return R.error(list.stream().collect(Collectors.joining(",")));
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
/**
|
||||
* 修改单价
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
//@RequiresPermissions("material:material:update")
|
||||
public R update(@RequestBody MaterialEntity price){
|
||||
Date date = new Date();
|
||||
MaterialPriceEntity priceEntity = new MaterialPriceEntity();
|
||||
priceEntity.setCostPrice(price.getCostPrice());
|
||||
priceEntity.setSalePrice(price.getSalePrice());
|
||||
priceEntity.setMaterialCode(price.getMaterialCode());
|
||||
priceEntity.setCreateTime(date);
|
||||
priceEntity.setCreateName(ShiroUtils.getUserEntity().getNickname());
|
||||
materialPriceService.save(priceEntity);
|
||||
price.setUpdateTime(date);
|
||||
price.setUpdateName(ShiroUtils.getUserEntity().getNickname());
|
||||
materialService.updateById(price);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
//@RequiresPermissions("material:material:delete")
|
||||
public R delete(@RequestBody Long[] materialIds){
|
||||
materialPriceService.removeByIds(Arrays.asList(materialIds));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.boge.modules.material.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.boge.modules.material.entity.MaterialEntity;
|
||||
import com.boge.modules.material.entity.MaterialPriceEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author ls
|
||||
* @email dengpbs@163.com
|
||||
* @date 2025-02-26 20:06:39
|
||||
*/
|
||||
@Mapper
|
||||
public interface MaterialPriceDao extends BaseMapper<MaterialPriceEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.boge.modules.material.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.boge.common.query.BaseQuery;
|
||||
import com.boge.modules.material.entity.MaterialPriceEntity;
|
||||
import lombok.Data;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author ls
|
||||
* @email dengpbs@163.com
|
||||
* @date 2025-02-26 20:06:39
|
||||
*/
|
||||
@Data
|
||||
public class MaterialPriceQuery extends BaseQuery<MaterialPriceEntity> {
|
||||
private String materialCode;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.boge.modules.material.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.boge.common.query.BaseQuery;
|
||||
import com.boge.common.query.QParam;
|
||||
import com.boge.common.query.QueryTEnum;
|
||||
import com.boge.modules.material.entity.MaterialEntity;
|
||||
import lombok.Data;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author ls
|
||||
* @email dengpbs@163.com
|
||||
* @date 2025-02-26 20:06:39
|
||||
*/
|
||||
@Data
|
||||
public class MaterialQuery extends BaseQuery<MaterialEntity> {
|
||||
private String key;
|
||||
|
||||
@Override
|
||||
public void paramMapping() {
|
||||
super.doP.put("key", QParam.builder().k(new String[]{"material_code","material_name"}).type(QueryTEnum.LK).build());
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,9 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import liquibase.pro.packaged.S;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -53,6 +53,18 @@ public class MaterialEntity implements Serializable {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String updateName;
|
||||
/**
|
||||
* 成本价
|
||||
*/
|
||||
private BigDecimal costPrice;
|
||||
/**
|
||||
* 销售价
|
||||
*/
|
||||
private BigDecimal salePrice;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.boge.modules.material.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author ls
|
||||
* @email dengpbs@163.com
|
||||
* @date 2025-02-26 20:06:39
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_material_price")
|
||||
public class MaterialPriceEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String materialCode;
|
||||
|
||||
/**
|
||||
* 成本价
|
||||
*/
|
||||
private BigDecimal costPrice;
|
||||
/**
|
||||
* 销售价
|
||||
*/
|
||||
private BigDecimal salePrice;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String createName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.boge.modules.material.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.boge.common.utils.PageUtils;
|
||||
import com.boge.modules.material.entity.MaterialEntity;
|
||||
import com.boge.modules.material.entity.MaterialPriceEntity;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author ls
|
||||
* @email dengpbs@163.com
|
||||
* @date 2025-02-26 20:06:39
|
||||
*/
|
||||
public interface MaterialPriceService extends IService<MaterialPriceEntity> {
|
||||
|
||||
List<String> importMarial(MultipartFile file);
|
||||
}
|
||||
|
||||
@@ -3,11 +3,13 @@ package com.boge.modules.material.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.boge.common.utils.PageUtils;
|
||||
import com.boge.modules.material.entity.MaterialEntity;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* @author ls
|
||||
* @email dengpbs@163.com
|
||||
@@ -16,5 +18,7 @@ import java.util.Map;
|
||||
public interface MaterialService extends IService<MaterialEntity> {
|
||||
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
|
||||
List<String> importMarial(MultipartFile file);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.boge.modules.material.service.impl;
|
||||
|
||||
import cn.hutool.poi.excel.ExcelReader;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.boge.common.exception.RRException;
|
||||
import com.boge.common.utils.PageUtils;
|
||||
import com.boge.common.utils.Query;
|
||||
import com.boge.modules.dict.service.ISysDictService;
|
||||
import com.boge.modules.material.dao.MaterialDao;
|
||||
import com.boge.modules.material.dao.MaterialPriceDao;
|
||||
import com.boge.modules.material.entity.MaterialEntity;
|
||||
import com.boge.modules.material.entity.MaterialPriceEntity;
|
||||
import com.boge.modules.material.service.MaterialPriceService;
|
||||
import com.boge.modules.material.service.MaterialService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Service()
|
||||
public class MaterialPriceServiceImpl extends ServiceImpl<MaterialPriceDao, MaterialPriceEntity> implements MaterialPriceService {
|
||||
|
||||
@Override
|
||||
public List<String> importMarial(MultipartFile file){
|
||||
if (file==null){
|
||||
throw new RRException("文件不存在");
|
||||
}
|
||||
List<String> errorInfo = new ArrayList<>();
|
||||
List<MaterialEntity> entitys = new ArrayList<>();
|
||||
Map<String, Integer> codeLine = new HashMap<>();
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
inputStream = file.getInputStream();
|
||||
ExcelReader excelReader = ExcelUtil.getReader(inputStream);
|
||||
List<List<Object>> read = excelReader.read();
|
||||
Date date = new Date();
|
||||
for (int i = 1; i < read.size(); i++) {
|
||||
List<Object> row = read.get(i);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(errorInfo)){
|
||||
|
||||
}
|
||||
}catch (Exception ex){
|
||||
throw new RRException(ex.getMessage());
|
||||
}finally {
|
||||
if (inputStream!=null){
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return errorInfo;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,24 @@
|
||||
package com.boge.modules.material.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.poi.excel.ExcelReader;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.boge.common.exception.RRException;
|
||||
import com.boge.common.utils.ShiroUtils;
|
||||
import com.boge.modules.dict.service.ISysDictService;
|
||||
import lombok.val;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.Map;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -11,11 +28,16 @@ import com.boge.common.utils.Query;
|
||||
import com.boge.modules.material.dao.MaterialDao;
|
||||
import com.boge.modules.material.entity.MaterialEntity;
|
||||
import com.boge.modules.material.service.MaterialService;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
||||
@Service("materialService")
|
||||
public class MaterialServiceImpl extends ServiceImpl<MaterialDao, MaterialEntity> implements MaterialService {
|
||||
|
||||
@Autowired
|
||||
private ISysDictService iSysDictService;
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
IPage<MaterialEntity> page = this.page(
|
||||
@@ -26,4 +48,72 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialDao, MaterialEntity
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public List<String> importMarial(MultipartFile file){
|
||||
if (file==null){
|
||||
throw new RRException("文件不存在");
|
||||
}
|
||||
List<String> errorInfo = new ArrayList<>();
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
inputStream = file.getInputStream();
|
||||
ExcelReader excelReader = ExcelUtil.getReader(inputStream);
|
||||
List<List<Object>> read = excelReader.read();
|
||||
|
||||
List<MaterialEntity> entitys = new ArrayList<>();
|
||||
Map<String, Integer> codeLine = new HashMap<>();
|
||||
Map<String, String> allLable = iSysDictService.getAllLable();
|
||||
Date date = new Date();
|
||||
String user = ShiroUtils.getUserEntity().getNickname();
|
||||
for (int i = 1; i < read.size(); i++) {
|
||||
List<Object> row = read.get(i);
|
||||
if (CollectionUtils.isEmpty(row)){
|
||||
continue;
|
||||
}
|
||||
if (row.size()<5){
|
||||
errorInfo.add("当前行"+i+":"+"参数不全");
|
||||
continue;
|
||||
}
|
||||
codeLine.put(String.valueOf( row.get(0)),i);
|
||||
|
||||
String type = allLable.get(String.valueOf(row.get(4)));
|
||||
if (StringUtils.isEmpty(type)){
|
||||
errorInfo.add("当前行"+i+":"+"物料类型不存在");
|
||||
continue;
|
||||
}
|
||||
MaterialEntity entity = new MaterialEntity();
|
||||
entity.setMaterialCode(String.valueOf( row.get(0)));
|
||||
entity.setMaterialName(String.valueOf( row.get(1)));
|
||||
entity.setMaterialSpec(String.valueOf( row.get(2)));
|
||||
entity.setUnitName(String.valueOf( row.get(3)));
|
||||
entity.setUpdateTime(date);
|
||||
entity.setUpdateName(user);
|
||||
entity.setMaterialType(Integer.valueOf(type));
|
||||
entitys.add(entity);
|
||||
}
|
||||
List<String> materialCodes = entitys.stream().map(MaterialEntity::getMaterialCode).collect(Collectors.toList());
|
||||
List<MaterialEntity> has = this.baseMapper.selectList(new QueryWrapper<MaterialEntity>()
|
||||
.in("material_code", materialCodes));
|
||||
if (!CollectionUtils.isEmpty(has)){
|
||||
has.forEach(a->{
|
||||
Integer integer = codeLine.get(a.getMaterialCode());
|
||||
errorInfo.add("当前行"+integer+":"+a.getMaterialCode()+"编码数据已存在");
|
||||
});
|
||||
}
|
||||
if (CollectionUtils.isEmpty(errorInfo)){
|
||||
this.saveBatch(entitys);
|
||||
}
|
||||
}catch (Exception ex){
|
||||
throw new RRException(ex.getMessage());
|
||||
}finally {
|
||||
if (inputStream!=null){
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return errorInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,24 +38,20 @@ public class PriceEntity implements Serializable {
|
||||
*/
|
||||
private String quoter;
|
||||
/**
|
||||
* 接收人
|
||||
* 发货方信息
|
||||
*/
|
||||
private String fattn;
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
private String fmobile;
|
||||
private String finc;
|
||||
private String fadd;
|
||||
private String ftel;
|
||||
/**
|
||||
* 客户id
|
||||
*/
|
||||
private Long clientId;
|
||||
/**
|
||||
* 客户接收人
|
||||
* 收货方信息
|
||||
*/
|
||||
private String tattn;
|
||||
/**
|
||||
* 客户接收人联系方法
|
||||
*/
|
||||
private String tmobile;
|
||||
private String tinc;
|
||||
private String tadd;
|
||||
private String ttel;
|
||||
/**
|
||||
* 物料信息
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
package com.boge.modules.project.contract.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.boge.common.query.PageQuery;
|
||||
import com.boge.common.utils.PageUtils;
|
||||
import com.boge.common.utils.R;
|
||||
import com.boge.modules.contract.entity.ContractEntity;
|
||||
import com.boge.modules.contract.entity.ContractQuery;
|
||||
import com.boge.modules.project.contract.entity.ProjectContractEntity;
|
||||
import com.boge.modules.project.contract.entity.ProjectContractQuery;
|
||||
import com.boge.modules.project.contract.service.ProjectContractService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -30,13 +35,11 @@ public class ProjectContractController {
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
//@RequiresPermissions("flow:contract:list")
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
PageUtils page = contractService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
public R list(PageQuery page, ProjectContractQuery query) {
|
||||
Page<ProjectContractEntity> entityPage = contractService.page(page.build(), query.build());
|
||||
return R.ok().put("page", new PageUtils(entityPage));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
|
||||
@@ -42,6 +42,10 @@ public class ProjectContractEntity implements Serializable {
|
||||
* 客户id
|
||||
*/
|
||||
private Long clientId;
|
||||
/**
|
||||
* 客户id
|
||||
*/
|
||||
private String clientName;
|
||||
/**
|
||||
* 物料信息
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.boge.modules.project.contract.entity;
|
||||
|
||||
import com.boge.common.query.BaseQuery;
|
||||
import com.boge.common.query.QParam;
|
||||
import com.boge.common.query.QueryTEnum;
|
||||
import com.boge.modules.contract.entity.ContractEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author ls
|
||||
* @email dengpbs@163.com
|
||||
* @date 2025-02-26 19:33:35
|
||||
*/
|
||||
@Data
|
||||
public class ProjectContractQuery extends BaseQuery<ProjectContractEntity> {
|
||||
private Integer isValidity;
|
||||
private Integer isAcceptance;
|
||||
private Integer contractType;
|
||||
private String contractNumber;
|
||||
private String[] acceptanceTime;
|
||||
private String clientName;
|
||||
|
||||
@Override
|
||||
public void paramMapping() {
|
||||
super.doP.put("contractNumber", QParam.builder().k(new String[]{"contract_number"}).type(QueryTEnum.LK).build());
|
||||
super.doP.put("clientName", QParam.builder().k(new String[]{"client_name"}).type(QueryTEnum.LK).build());
|
||||
super.doP.put("startTime", QParam.builder().k(new String[]{"acceptance_time"}).type(QueryTEnum.GE).build());
|
||||
super.doP.put("endTime", QParam.builder().k(new String[]{"acceptance_time"}).type(QueryTEnum.LE).build());
|
||||
super.doP.put("isValidity", QParam.builder().k(new String[]{"AND NOW()"+(Integer.valueOf(1).equals(isValidity)?"<=":">")+" DATE_ADD(acceptance_time, INTERVAL validity DAY)"}).type(QueryTEnum.LASTSQL).build());
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserDao, SysUserEntity> i
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
String username = (String)params.get("username");
|
||||
Long createUserId = (Long)params.get("createUserId");
|
||||
IPage<SysUserEntity> page = this.page(
|
||||
new Query<SysUserEntity>().getPage(params),
|
||||
new QueryWrapper<SysUserEntity>()
|
||||
|
||||
Reference in New Issue
Block a user