
11 changed files with 503 additions and 0 deletions
@ -0,0 +1,44 @@ |
|||
package com.yxt.supervise.cyf.api.materialprocurementdetails; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.yxt.common.core.domain.BaseEntity; |
|||
import io.swagger.annotations.ApiModel; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author feikefei |
|||
* @create 2023-06-02-9:17 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "原料采购明细", description = "原料采购明细") |
|||
@TableName("material_procurement_details") |
|||
public class MaterialProcurementDetails extends BaseEntity { |
|||
//供应商
|
|||
private String supplierSid; |
|||
//合同签订日期
|
|||
private String contractSigningDate; |
|||
//原油类型
|
|||
private String typeSid; |
|||
//单价
|
|||
private double price; |
|||
//重量
|
|||
private double weight; |
|||
//付款日期
|
|||
private String paymentDate; |
|||
//付款金额
|
|||
private double payment; |
|||
//付款单位
|
|||
private String payer; |
|||
//付款单位开户行
|
|||
private String payerBank; |
|||
//收款单位
|
|||
private String payee; |
|||
//收款单位开户行
|
|||
private String payeeBank; |
|||
//摘要
|
|||
private String paymentSummary; |
|||
private String orderNumber; |
|||
//区分1原油 2包装物 3原料
|
|||
private String type; |
|||
private String arrivalDate; |
|||
} |
@ -0,0 +1,54 @@ |
|||
package com.yxt.supervise.cyf.api.materialprocurementdetails; |
|||
|
|||
import com.yxt.common.core.dto.Dto; |
|||
import com.yxt.supervise.cyf.api.crudeoiltypeinformation.CrudeOilTypeInformationDto; |
|||
import com.yxt.supervise.cyf.api.materialinventory.MaterialInventoryDto; |
|||
import io.swagger.annotations.ApiModel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author feikefei |
|||
* @create 2023-06-02-9:20 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "原料采购明细 数据传输对象", description = "原料采购明细 数据传输对象") |
|||
public class MaterialProcurementDetailsDto implements Dto { |
|||
private String id; |
|||
private String sid; |
|||
|
|||
//供应商
|
|||
private String supplierSid; |
|||
//合同签订日期
|
|||
private String contractSigningDate; |
|||
//原油类型
|
|||
private String typeSid; |
|||
//单价
|
|||
private double price; |
|||
//重量
|
|||
private double weight; |
|||
//付款日期
|
|||
private String paymentDate; |
|||
//付款金额
|
|||
private double payment; |
|||
//付款单位
|
|||
private String payer; |
|||
//付款单位开户行
|
|||
private String payerBank; |
|||
//收款单位
|
|||
private String payee; |
|||
//收款单位开户行
|
|||
private String payeeBank; |
|||
//摘要
|
|||
private String paymentSummary; |
|||
//订单状态
|
|||
private String state; |
|||
//订单编号
|
|||
private String orderNumber; |
|||
//
|
|||
private String type; |
|||
//到货日期
|
|||
private String arrivalDate; |
|||
private List<MaterialInventoryDto> commodityList; |
|||
} |
@ -0,0 +1,45 @@ |
|||
package com.yxt.supervise.cyf.api.materialprocurementdetails; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import io.swagger.annotations.ApiModel; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author feikefei |
|||
* @create 2023-06-02-9:21 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "原料采购明细 查询条件", description = "原料采购明细 查询条件") |
|||
public class MaterialProcurementDetailsQuery implements Query { |
|||
private String id; |
|||
private String sid; |
|||
|
|||
//供应商
|
|||
private String supplierSid; |
|||
//合同签订日期
|
|||
private String contractSigningDate; |
|||
//原油类型
|
|||
private String typeSid; |
|||
//单价
|
|||
private double price; |
|||
//重量
|
|||
private double weight; |
|||
//付款日期
|
|||
private String paymentDate; |
|||
//付款金额
|
|||
private double payment; |
|||
//付款单位
|
|||
private String payer; |
|||
//付款单位开户行
|
|||
private String payerBank; |
|||
//收款单位
|
|||
private String payee; |
|||
//收款单位开户行
|
|||
private String payeeBank; |
|||
//摘要
|
|||
private String paymentSummary; |
|||
//订单状态
|
|||
private String state; |
|||
//区分1原油 2包装物 3原料
|
|||
private String type; |
|||
} |
@ -0,0 +1,71 @@ |
|||
package com.yxt.supervise.cyf.api.materialprocurementdetails; |
|||
|
|||
import com.yxt.common.core.vo.Vo; |
|||
import com.yxt.supervise.cyf.api.crudeoiltypeinformation.CrudeOilTypeInformationVo; |
|||
import com.yxt.supervise.cyf.api.materialinventory.MaterialInventoryVo; |
|||
import io.swagger.annotations.ApiModel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author feikefei |
|||
* @create 2023-06-02-9:22 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "原料采购明细 视图数据对象", description = "原料采购明细 视图数据对象") |
|||
public class MaterialProcurementDetailsVo implements Vo { |
|||
private String id; |
|||
private String sid; |
|||
|
|||
//供应商
|
|||
private String supplierSid; |
|||
//合同签订日期
|
|||
private String contractSigningDate; |
|||
//原油类型
|
|||
private String typeSid; |
|||
//单价
|
|||
private double price; |
|||
//重量
|
|||
private double weight; |
|||
//付款日期
|
|||
private String paymentDate; |
|||
//付款金额
|
|||
private double payment; |
|||
//付款单位
|
|||
private String payer; |
|||
//付款单位开户行
|
|||
private String payerBank; |
|||
//收款单位
|
|||
private String payee; |
|||
//收款单位开户行
|
|||
private String payeeBank; |
|||
//摘要
|
|||
private String paymentSummary; |
|||
//订单状态
|
|||
private String state; |
|||
//供应商名称
|
|||
private String supplierName; |
|||
//供应商编码
|
|||
private String supplierNumber; |
|||
//类型名称
|
|||
private String typeName; |
|||
//类型编码
|
|||
private String typeNumber; |
|||
//商品名称
|
|||
private String tradeName; |
|||
//商品编码
|
|||
private String productCode; |
|||
//订单编号
|
|||
private String orderNumber; |
|||
//状态value
|
|||
private String stateValue; |
|||
//种类数量
|
|||
private Integer amount; |
|||
//预计到货日期
|
|||
private String arrivalDate; |
|||
//总价值
|
|||
private double totalValue; |
|||
|
|||
private List<MaterialInventoryVo> commodityList; |
|||
} |
@ -0,0 +1,68 @@ |
|||
package com.yxt.supervise.cyf.biz.materialprocurementdetails; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
|||
import com.yxt.supervise.cyf.api.crudeoiltypeinformation.CrudeOilTypeInformationVo; |
|||
import com.yxt.supervise.cyf.api.materialinventory.MaterialInventory; |
|||
import com.yxt.supervise.cyf.api.materialinventory.MaterialInventoryVo; |
|||
import com.yxt.supervise.cyf.api.materialprocurementdetails.MaterialProcurementDetails; |
|||
import com.yxt.supervise.cyf.api.materialprocurementdetails.MaterialProcurementDetailsVo; |
|||
import com.yxt.supervise.cyf.api.procurementdetails.ProcurementDetailsVo; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.apache.ibatis.annotations.Select; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author feikefei |
|||
* @create 2023-06-02-9:25 |
|||
*/ |
|||
@Mapper |
|||
public interface MaterialProcurementDetailsMapper extends BaseMapper<MaterialProcurementDetails> { |
|||
IPage<MaterialProcurementDetailsVo> selectPageVo(IPage<MaterialProcurementDetails> page, @Param(Constants.WRAPPER) Wrapper<MaterialProcurementDetails> qw); |
|||
|
|||
@Select("select * from material_procurement_details where sid=#{sid}") |
|||
List<MaterialProcurementDetailsVo> getMaterialBySid(@Param("sid")String sid); |
|||
|
|||
@Select("SELECT\n" + |
|||
"\td.*,\n" + |
|||
"\ts.supplierNumber AS supplierNumber,\n" + |
|||
"\ts.supplierName AS supplierName,\n" + |
|||
"CASE\n" + |
|||
"\t\td.state \n" + |
|||
"\t\tWHEN 1 THEN\n" + |
|||
"\t\t'待提交' \n" + |
|||
"\t\tWHEN 2 THEN\n" + |
|||
"\t\t'经理审批' \n" + |
|||
"\t\tWHEN 3 THEN\n" + |
|||
"\t\t'监管审批' \n" + |
|||
"\t\tWHEN 4 THEN\n" + |
|||
"\t\t'银行审批' \n" + |
|||
"\t\tWHEN 5 THEN\n" + |
|||
"\t\t'财务审批' \n" + |
|||
"\t\tWHEN 6 THEN\n" + |
|||
"\t\t'待入库' \n" + |
|||
"\t\tWHEN 7 THEN\n" + |
|||
"\t\t'已完成' \n" + |
|||
"\tEND AS stateValue ,count(1) as amount,\n" + |
|||
"\tsum(d.price * d.weight) as totalValue\n" + |
|||
"FROM\n" + |
|||
"\tmaterial_procurement_details d\n" + |
|||
"\tleft JOIN supplier_information s on d.supplierSid =s.sid\n" + |
|||
"\tleft join material_inventory c on c.sid =d.typeSid \n" + |
|||
"\tleft join material_type m on m.sid =c.typeSid \n" + |
|||
"WHERE\n" + |
|||
"\td.sid=#{sid} \n" + |
|||
"GROUP BY\n" + |
|||
"\td.sid ") |
|||
MaterialProcurementDetailsVo getProBySid(@Param("sid")String sid); |
|||
|
|||
@Select("select * from material_inventory where sid=#{sid}") |
|||
MaterialInventoryVo getMaterial1BySid(@Param("sid")String sid); |
|||
|
|||
@Select("select * from material_procurement_details where sid = #{sid}") |
|||
List<MaterialProcurementDetails> selectList(@Param("sid") String sid); |
|||
} |
@ -0,0 +1,16 @@ |
|||
<?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="com.yxt.supervise.cyf.biz.materialprocurementdetails.MaterialProcurementDetailsMapper"> |
|||
<select id="selectPageVo" resultType="com.yxt.supervise.cyf.api.materialprocurementdetails.MaterialProcurementDetailsVo"> |
|||
SELECT d.*, s.supplierNumber AS supplierNumber, s.supplierName AS supplierName, c.name AS tradeName, c.number AS productCode, c.name AS typeName, c.number AS typeNumber, |
|||
CASE d.state WHEN 1 THEN '待提交' WHEN 2 THEN '经理审批' WHEN 3 THEN '监管审批' WHEN 4 THEN '银行审批' WHEN 5 THEN '财务审批' WHEN 6 THEN '待入库' WHEN 7 THEN '已完成' END AS stateValue, count(1) AS amount, sum(d.price * d.weight) AS totalValue |
|||
FROM material_procurement_details d |
|||
left JOIN supplier_information s on d.supplierSid =s.sid |
|||
left join material_inventory c on c.sid =d.typeSid |
|||
left join material_type m on m.sid =c.typeSid |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
GROUP BY d.sid |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,62 @@ |
|||
package com.yxt.supervise.cyf.biz.materialprocurementdetails; |
|||
|
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.supervise.cyf.api.materialprocurementdetails.MaterialProcurementDetailsDto; |
|||
import com.yxt.supervise.cyf.api.materialprocurementdetails.MaterialProcurementDetailsQuery; |
|||
import com.yxt.supervise.cyf.api.materialprocurementdetails.MaterialProcurementDetailsVo; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* @author feikefei |
|||
* @create 2023-06-02-9:23 |
|||
*/ |
|||
@Api(tags = "原料采购信息") |
|||
@RestController |
|||
@RequestMapping("cyf/materialProcurement") |
|||
public class MaterialProcurementDetailsRest { |
|||
@Autowired |
|||
private MaterialProcurementDetailsService materialProcurementDetailsService; |
|||
|
|||
@ApiOperation("根据条件分页查询数据的列表") |
|||
@PostMapping("/listPage") |
|||
public ResultBean<PagerVo<MaterialProcurementDetailsVo>> listPage(@RequestBody PagerQuery<MaterialProcurementDetailsQuery> pq) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
PagerVo<MaterialProcurementDetailsVo> pv = materialProcurementDetailsService.listPageVo(pq); |
|||
return rb.success().setData(pv); |
|||
} |
|||
|
|||
@ApiOperation("添加") |
|||
@PostMapping("/save") |
|||
public ResultBean save(@RequestBody MaterialProcurementDetailsDto dto){ |
|||
return materialProcurementDetailsService.save(dto); |
|||
} |
|||
|
|||
@ApiOperation("提交") |
|||
@PostMapping("/submit") |
|||
public ResultBean submit(@RequestBody MaterialProcurementDetailsDto dto){ |
|||
return materialProcurementDetailsService.submit(dto); |
|||
} |
|||
|
|||
@ApiOperation("修改") |
|||
@PostMapping("/update") |
|||
public ResultBean update(@RequestBody MaterialProcurementDetailsDto dto){ |
|||
return materialProcurementDetailsService.update(dto); |
|||
} |
|||
|
|||
@ApiOperation("删除") |
|||
@DeleteMapping("/delete/{sid}") |
|||
public ResultBean delete(@PathVariable String sid ){ |
|||
return materialProcurementDetailsService.del(sid); |
|||
} |
|||
|
|||
@ApiOperation("根据sid查询") |
|||
@GetMapping("/getMaterialProcurementBySid/{sid}") |
|||
public ResultBean getMaterialProcurementBySid(@PathVariable String sid){ |
|||
return materialProcurementDetailsService.getMaterialProcurementBySid(sid); |
|||
} |
|||
} |
@ -0,0 +1,138 @@ |
|||
package com.yxt.supervise.cyf.biz.materialprocurementdetails; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import com.yxt.common.base.utils.PagerUtil; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.supervise.cyf.api.materialinventory.MaterialInventoryDto; |
|||
import com.yxt.supervise.cyf.api.materialinventory.MaterialInventoryVo; |
|||
import com.yxt.supervise.cyf.api.materialprocurementdetails.MaterialProcurementDetails; |
|||
import com.yxt.supervise.cyf.api.materialprocurementdetails.MaterialProcurementDetailsDto; |
|||
import com.yxt.supervise.cyf.api.materialprocurementdetails.MaterialProcurementDetailsQuery; |
|||
import com.yxt.supervise.cyf.api.materialprocurementdetails.MaterialProcurementDetailsVo; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author feikefei |
|||
* @create 2023-06-02-9:25 |
|||
*/ |
|||
@Service |
|||
public class MaterialProcurementDetailsService extends MybatisBaseService<MaterialProcurementDetailsMapper, MaterialProcurementDetails> { |
|||
|
|||
public PagerVo<MaterialProcurementDetailsVo> listPageVo(PagerQuery<MaterialProcurementDetailsQuery> pq) { |
|||
MaterialProcurementDetailsQuery query = pq.getParams(); |
|||
QueryWrapper<MaterialProcurementDetails> qw = new QueryWrapper<>(); |
|||
if (StringUtils.isNotBlank(query.getType())) { |
|||
qw.eq("d.supplierNumber", query.getType()); |
|||
} |
|||
if (StringUtils.isNotBlank(query.getState())) { |
|||
qw.eq("d.state", query.getState()); |
|||
} |
|||
IPage<MaterialProcurementDetails> page = PagerUtil.queryToPage(pq); |
|||
IPage<MaterialProcurementDetailsVo> pagging = baseMapper.selectPageVo(page, qw); |
|||
PagerVo<MaterialProcurementDetailsVo> p = PagerUtil.pageToVo(pagging, null); |
|||
return p; |
|||
} |
|||
|
|||
public ResultBean save(MaterialProcurementDetailsDto dto){ |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
MaterialProcurementDetails entity = new MaterialProcurementDetails(); |
|||
BeanUtil.copyProperties(dto, entity, "sid"); |
|||
if (dto.getCommodityList().size() > 1){ |
|||
for(MaterialInventoryDto pro : dto.getCommodityList()){ |
|||
entity.setTypeSid(pro.getSid()); |
|||
entity.setState(1); |
|||
entity.setType("3"); |
|||
entity.setWeight(pro.getWeight()); |
|||
entity.setPrice(pro.getPrice()); |
|||
baseMapper.insert(entity); |
|||
} |
|||
return rb.success().setMsg("新增成功"); |
|||
}else { |
|||
for(MaterialInventoryDto pro : dto.getCommodityList()){ |
|||
entity.setTypeSid(pro.getSid()); |
|||
entity.setState(1); |
|||
entity.setType("3"); |
|||
entity.setWeight(pro.getWeight()); |
|||
entity.setPrice(pro.getPrice()); |
|||
baseMapper.insert(entity); |
|||
} |
|||
return rb.success().setMsg("新增成功"); |
|||
} |
|||
} |
|||
|
|||
public ResultBean submit(MaterialProcurementDetailsDto dto){ |
|||
ResultBean rb = new ResultBean(); |
|||
List<MaterialProcurementDetails> materialProcurementDetails = baseMapper.selectList(new QueryWrapper<MaterialProcurementDetails>().eq("sid",dto.getSid())); |
|||
//不存在保存加提交
|
|||
if(dto.getSid().equals("")||dto.getSid().equals(null)){ |
|||
MaterialProcurementDetails entity = new MaterialProcurementDetails(); |
|||
if(dto.getCommodityList().size()>1){ |
|||
for(MaterialInventoryDto pro:dto.getCommodityList()){ |
|||
BeanUtil.copyProperties(dto, entity, "sid"); |
|||
entity.setTypeSid(pro.getTypeSid()); |
|||
entity.setState(2); |
|||
entity.setType("3"); |
|||
entity.setWeight(pro.getWeight()); |
|||
entity.setPrice(pro.getPrice()); |
|||
baseMapper.insert(entity); |
|||
} |
|||
return rb.success().setMsg("新增成功"); |
|||
} |
|||
for(MaterialInventoryDto pro : dto.getCommodityList()){ |
|||
BeanUtil.copyProperties(dto, entity, "sid"); |
|||
entity.setTypeSid(pro.getTypeSid()); |
|||
entity.setState(2); |
|||
entity.setType("3"); |
|||
entity.setWeight(pro.getWeight()); |
|||
entity.setPrice(pro.getPrice()); |
|||
baseMapper.insert(entity); |
|||
} |
|||
}else{ |
|||
//存在该状态
|
|||
for(MaterialProcurementDetails pro : materialProcurementDetails){ |
|||
pro.setState(pro.getState()+1); |
|||
baseMapper.updateById(pro); |
|||
} |
|||
} |
|||
return rb.success().setMsg("提交成功"); |
|||
} |
|||
|
|||
public ResultBean update (MaterialProcurementDetailsDto dto){ |
|||
ResultBean rb = new ResultBean(); |
|||
String dtoSid = dto.getSid(); |
|||
baseMapper.delete(new QueryWrapper<MaterialProcurementDetails>().eq("sid",dtoSid)); |
|||
dto.setSid(dtoSid); |
|||
save(dto); |
|||
return rb.success().setMsg("修改成功"); |
|||
} |
|||
|
|||
public ResultBean del(String sid){ |
|||
ResultBean rb=new ResultBean(); |
|||
baseMapper.delete(new QueryWrapper<MaterialProcurementDetails>().eq("sid",sid)); |
|||
return rb.success().setMsg("删除成功"); |
|||
} |
|||
|
|||
public ResultBean getMaterialProcurementBySid(String sid){ |
|||
ResultBean rb=new ResultBean(); |
|||
List<MaterialProcurementDetailsVo> RawProcurementDetails = baseMapper.getMaterialBySid(sid); |
|||
MaterialProcurementDetailsVo materialProcurementDetailsVo = baseMapper.getProBySid(sid); |
|||
List<MaterialInventoryVo> list =new ArrayList<>(); |
|||
for (MaterialProcurementDetailsVo pro : RawProcurementDetails){ |
|||
MaterialInventoryVo materialInventoryVo = baseMapper.getMaterial1BySid(pro.getTypeSid()); |
|||
materialInventoryVo.setWeight(pro.getWeight()); |
|||
materialInventoryVo.setPrice(pro.getPrice()); |
|||
list.add(materialInventoryVo); |
|||
} |
|||
materialProcurementDetailsVo.setCommodityList(list); |
|||
return rb.success().setData(materialProcurementDetailsVo); |
|||
} |
|||
} |
Loading…
Reference in new issue