12 changed files with 505 additions and 0 deletions
@ -0,0 +1,43 @@ |
|||||
|
package com.yxt.supervise.cyf.api.procurementdetails; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.yxt.common.core.domain.BaseEntity; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:26 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(value = "采购明细", description = "采购明细") |
||||
|
@TableName("procurement_details") |
||||
|
public class ProcurementDetails 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; |
||||
|
|
||||
|
//区分1原油 2包装物 3原料
|
||||
|
private String type; |
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
package com.yxt.supervise.cyf.api.procurementdetails; |
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:28 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(value = "采购明细 视图数据详情", description = "采购明细 视图数据详情") |
||||
|
public class ProcurementDetailsDetailsVo 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;} |
@ -0,0 +1,47 @@ |
|||||
|
package com.yxt.supervise.cyf.api.procurementdetails; |
||||
|
|
||||
|
import com.yxt.common.core.dto.Dto; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:28 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(value = "采购明细 数据传输对象", description = "采购明细 数据传输对象") |
||||
|
public class ProcurementDetailsDto 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; |
||||
|
} |
@ -0,0 +1,45 @@ |
|||||
|
package com.yxt.supervise.cyf.api.procurementdetails; |
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:29 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(value = "采购明细 查询条件", description = "采购明细 查询条件") |
||||
|
public class ProcurementDetailsQuery 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,59 @@ |
|||||
|
package com.yxt.supervise.cyf.api.procurementdetails; |
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:29 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(value = "采购明细 视图数据对象", description = "采购明细 视图数据对象") |
||||
|
public class ProcurementDetailsVo 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; |
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
package com.yxt.supervise.cyf.biz.procurementdetails; |
||||
|
|
||||
|
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.procurementdetails.ProcurementDetails; |
||||
|
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 wangpengfei |
||||
|
* @date 2023/5/4 14:37 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface ProcurementDetailsMapper extends BaseMapper<ProcurementDetails> { |
||||
|
IPage<ProcurementDetailsVo> selectPageVo(IPage<ProcurementDetails> page, @Param(Constants.WRAPPER) Wrapper<ProcurementDetails> qw,@Param("type") String type); |
||||
|
@Select("select * from procurement_details where state =#{state}") |
||||
|
List<ProcurementDetailsVo> listByState(String state); |
||||
|
@Select(" SELECT" + |
||||
|
" *,t.name as typeName,i.inventory as inventory" + |
||||
|
" FROM" + |
||||
|
" material_outbound o" + |
||||
|
" left join material_inventory i on i.sid=o.inventorySid" + |
||||
|
" left join material_type t on t.sid=i.typeSid") |
||||
|
List<ProcurementDetailsVo> outboundList(); |
||||
|
@Select("select * from tank_information where sid=#{sid}") |
||||
|
ProcurementDetails getOutboundBySid(@Param("sid")String sid); |
||||
|
} |
@ -0,0 +1,55 @@ |
|||||
|
<?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.procurementdetails.ProcurementDetailsMapper"> |
||||
|
<!-- <where> ${ew.sqlSegment} </where>--> |
||||
|
<!-- ${ew.customSqlSegment} --> |
||||
|
<select id="selectPageVo" resultType="com.yxt.supervise.cyf.api.procurementdetails.ProcurementDetailsVo"> |
||||
|
SELECT |
||||
|
<if test="type=='1'.toString()"> |
||||
|
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 |
||||
|
</if> |
||||
|
<if test="type=='2'.toString() or type=='3'.toString()"> |
||||
|
d.*,s.supplierNumber as supplierNumber, s.supplierName as supplierName , |
||||
|
c.name as tradeName,c.number as productCode,m.name as typeName,m.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 |
||||
|
</if> |
||||
|
FROM |
||||
|
procurement_details d |
||||
|
<if test="type =='1'.toString()"> |
||||
|
left JOIN supplier_information s on d.supplierSid =s.sid |
||||
|
left join crude_oil_type_information c on c.sid =d.typeSid |
||||
|
</if> |
||||
|
<if test="type =='2'.toString()"> |
||||
|
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 |
||||
|
</if> |
||||
|
<if test="type =='3'.toString()"> |
||||
|
left JOIN supplier_information s on d.supplierSid =s.sid |
||||
|
left join packaging_inventory c on c.sid =d.typeSid |
||||
|
left join packaging_type m on m.sid =c.typeSid |
||||
|
</if> |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,68 @@ |
|||||
|
package com.yxt.supervise.cyf.biz.procurementdetails; |
||||
|
|
||||
|
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.materialtype.MaterialTypeDto; |
||||
|
import com.yxt.supervise.cyf.api.procurementdetails.ProcurementDetailsDto; |
||||
|
import com.yxt.supervise.cyf.api.procurementdetails.ProcurementDetailsQuery; |
||||
|
import com.yxt.supervise.cyf.api.procurementdetails.ProcurementDetailsVo; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:38 |
||||
|
*/ |
||||
|
@Api(tags = "采购信息") |
||||
|
@RestController |
||||
|
@RequestMapping("cyf/procurement") |
||||
|
public class ProcurementDetailsRest { |
||||
|
@Autowired |
||||
|
ProcurementDetailsService RawProcurementDetailsService; |
||||
|
|
||||
|
@ApiOperation("根据条件分页查询数据的列表") |
||||
|
@PostMapping("/listPage") |
||||
|
public ResultBean<PagerVo<ProcurementDetailsVo>> listPage(@RequestBody PagerQuery<ProcurementDetailsQuery> pq) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
PagerVo<ProcurementDetailsVo> pv = RawProcurementDetailsService.listPageVo(pq); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
@ApiOperation("根据订单状态查询数据的列表") |
||||
|
@PostMapping("/listByState") |
||||
|
public ResultBean<PagerVo<ProcurementDetailsVo>> listBystate(String state) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<ProcurementDetailsVo> pv = RawProcurementDetailsService.listByState(state); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
@ApiOperation("新增") |
||||
|
@PostMapping("/save") |
||||
|
public ResultBean save (@RequestBody ProcurementDetailsDto dto){ |
||||
|
return RawProcurementDetailsService.save(dto); |
||||
|
} |
||||
|
@ApiOperation("提交") |
||||
|
@PostMapping("submit") |
||||
|
public ResultBean submit (@RequestBody ProcurementDetailsDto dto){ |
||||
|
return RawProcurementDetailsService.submit(dto); |
||||
|
} |
||||
|
@ApiOperation("修改") |
||||
|
@PostMapping("/update") |
||||
|
public ResultBean update (@RequestBody ProcurementDetailsDto dto){ |
||||
|
return RawProcurementDetailsService.update(dto); |
||||
|
} |
||||
|
|
||||
|
@ApiOperation("根据sid查询") |
||||
|
@GetMapping("/getProcurementBySid/{sid}") |
||||
|
public ResultBean getOutboundBySid(@PathVariable String sid){ |
||||
|
return RawProcurementDetailsService.getOutboundBySid(sid); |
||||
|
} |
||||
|
@ApiOperation("删除") |
||||
|
@DeleteMapping("/delete/{sid}") |
||||
|
public ResultBean delete(@PathVariable String sid ){ |
||||
|
return RawProcurementDetailsService.del(sid); |
||||
|
} |
||||
|
} |
@ -0,0 +1,110 @@ |
|||||
|
package com.yxt.supervise.cyf.biz.procurementdetails; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import cn.hutool.core.date.DateUtil; |
||||
|
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.MaterialInventory; |
||||
|
import com.yxt.supervise.cyf.api.materialtype.MaterialType; |
||||
|
import com.yxt.supervise.cyf.api.materialtype.MaterialTypeDto; |
||||
|
import com.yxt.supervise.cyf.api.procurementdetails.ProcurementDetails; |
||||
|
import com.yxt.supervise.cyf.api.procurementdetails.ProcurementDetailsDto; |
||||
|
import com.yxt.supervise.cyf.api.procurementdetails.ProcurementDetailsQuery; |
||||
|
import com.yxt.supervise.cyf.api.procurementdetails.ProcurementDetailsVo; |
||||
|
import com.yxt.supervise.cyf.biz.materialinventory.MaterialInventoryMapper; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:37 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class ProcurementDetailsService extends MybatisBaseService<ProcurementDetailsMapper, ProcurementDetails> { |
||||
|
|
||||
|
@Autowired |
||||
|
MaterialInventoryMapper rawMaterialInventoryMapper; |
||||
|
public PagerVo<ProcurementDetailsVo> listPageVo(PagerQuery<ProcurementDetailsQuery> pq) { |
||||
|
ProcurementDetailsQuery query = pq.getParams(); |
||||
|
QueryWrapper<ProcurementDetails> qw = new QueryWrapper<>(); |
||||
|
// if (StringUtils.isNotBlank(query.getDate())) {
|
||||
|
// qw.eq("STR_TO_DATE(o.deliveryDate,'%Y-%m-%d')", query.getDate());
|
||||
|
// }
|
||||
|
if (StringUtils.isNotBlank(query.getType())) { |
||||
|
qw.eq("d.type", query.getType()); |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(query.getState())) { |
||||
|
qw.eq("d.state", query.getState()); |
||||
|
} |
||||
|
String type =query.getType(); |
||||
|
IPage<ProcurementDetails> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<ProcurementDetailsVo> pagging = baseMapper.selectPageVo(page, qw,type); |
||||
|
PagerVo<ProcurementDetailsVo> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
public List<ProcurementDetailsVo> listByState(String state) { |
||||
|
List<ProcurementDetailsVo> pagging = baseMapper.listByState(state); |
||||
|
return pagging; |
||||
|
} |
||||
|
|
||||
|
public ResultBean save(ProcurementDetailsDto dto){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
ProcurementDetails entity=new ProcurementDetails(); |
||||
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
||||
|
entity.setState(1); |
||||
|
Date curDate = new Date(); |
||||
|
String dfmt = DateUtil.format(curDate, "yyyy-MM-dd"); |
||||
|
baseMapper.insert(entity); |
||||
|
return rb.success().setMsg("新增成功"); |
||||
|
} |
||||
|
public ResultBean submit(ProcurementDetailsDto dto){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
String sid =dto.getSid(); |
||||
|
//不存在直接提交
|
||||
|
if(sid.equals("")||sid.equals(null)){ |
||||
|
ProcurementDetails entity=new ProcurementDetails(); |
||||
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
||||
|
Date curDate = new Date(); |
||||
|
entity.setState(2); |
||||
|
String dfmt = DateUtil.format(curDate, "yyyy-MM-dd"); |
||||
|
//entity.setDeliveryDate(dfmt);
|
||||
|
baseMapper.insert(entity); |
||||
|
}else{ |
||||
|
//存在该状态
|
||||
|
ProcurementDetails entity=fetchBySid(sid); |
||||
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
||||
|
entity.setState(2); |
||||
|
baseMapper.updateById(entity); |
||||
|
} |
||||
|
return rb.success().setMsg("提交成功"); |
||||
|
} |
||||
|
|
||||
|
public ResultBean update (ProcurementDetailsDto dto){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
String dtoSid = dto.getSid(); |
||||
|
ProcurementDetails entity=fetchBySid(dtoSid); |
||||
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
||||
|
baseMapper.updateById(entity); |
||||
|
return rb.success().setMsg("修改成功"); |
||||
|
} |
||||
|
public ResultBean getOutboundBySid(String sid){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
ProcurementDetails RawProcurementDetails=baseMapper.getOutboundBySid(sid); |
||||
|
return rb.success().setData(RawProcurementDetails); |
||||
|
} |
||||
|
|
||||
|
public ResultBean del(String sid){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
baseMapper.delete(new QueryWrapper<ProcurementDetails>().eq("sid",sid)); |
||||
|
return rb.success().setMsg("删除成功"); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue