6d2440d2 康伟

kangwei:赋能中心-药剂统购分销

1 个父辈 6dfd14be
package com.skua.modules.erp.controller;
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.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.context.SpringContextUtils;
import com.skua.core.query.QueryGenerator;
import com.skua.modules.erp.entity.ErpSettlement;
import com.skua.modules.erp.vo.AgentiaStatisticsVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@Slf4j
@Api(tags="赋能中心")
@RestController("erpReportController")
@RequestMapping("/web/erp/report")
public class ErpReportController {
@AutoLog(value = "赋能中心-药剂统购分销")
@ApiOperation(value="赋能中心-药剂统购分销", notes="赋能中心-药剂统购分销")
@GetMapping(value = "/agentiaStatistics")
public Result<List<AgentiaStatisticsVO>> agentiaStatistics() {
Result<List<AgentiaStatisticsVO>> result = new Result<List<AgentiaStatisticsVO>>();
String sql ="select d.depart_name , mi.material_num ,sm.supp_name 'supplier_name' ,aaa.* from (";
sql +=" select pp.depart_id , ppi.sparepart_name ,ppi.purchase_num 'plan_num' ,ppi.sparepart_id from erp_purchase_plan_item ppi ,erp_purchase_plan pp where ppi.plan_id = pp.id and pp.apply_year = year(now()) )aaa";
sql +=" left join sys_depart d on d.id = aaa.depart_id ";
sql +=" left join erp_material_in mi on (aaa.depart_id = mi.depart_id and aaa.sparepart_id = mi.sparepart_id )";
sql +=" left join ajh_supplier_manage sm on sm.id = aaa.sparepart_id";
//主库数据源
JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master");
List<AgentiaStatisticsVO> dataList = masterDB.query(sql,new BeanPropertyRowMapper<AgentiaStatisticsVO>(AgentiaStatisticsVO.class));
result.setSuccess(true);
result.setResult(dataList);
return result;
}
}
......@@ -21,6 +21,7 @@ import com.skua.modules.erp.service.IErpSettlementService;
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.skua.modules.erp.vo.ErpSettlementFormVO;
import com.skua.modules.erp.vo.ErpSettlementVO;
import com.skua.modules.productionduty.utils.HolidaysUtils;
import com.skua.modules.quartz.util.BaseUtil;
......@@ -265,12 +266,26 @@ public class ErpSettlementController {
return result;
}
@AutoLog(value = "药剂结算单详情-导出:送货单以及物资验收单")
@ApiOperation(value="药剂结算单详情-导出:送货单以及物资验收单", notes="药剂结算单详情-导出:送货单以及物资验收单")
@GetMapping(value = "/exportSupplierFormPDF")
public Result<ErpSettlementVO> exportSupplierFormPDF(@RequestParam(name="id",required=true) String id) {
Result<ErpSettlementVO> result = new Result<ErpSettlementVO>();
ErpSettlementVO erpSettlement = erpSettlementService.queryById(id);
@AutoLog(value = "药剂结算单详情-导出:(供应商)送货单以及物资验收单")
@ApiOperation(value="药剂结算单详情-导出:(供应商)送货单以及物资验收单", notes="药剂结算单详情-导出:送货单以及物资验收单")
@GetMapping(value = "/exportSupplierSupplierFormPDF")
public Result<ErpSettlementFormVO> exportSupplierSupplierFormPDF(@RequestParam(name="id",required=true) String id) {
Result<ErpSettlementFormVO> result = new Result<ErpSettlementFormVO>();
ErpSettlementFormVO erpSettlement = erpSettlementService.querySupplierSettlementFormById(id);
if(erpSettlement==null) {
result.error500("未找到对应实体");
}else {
result.setResult(erpSettlement);
result.setSuccess(true);
}
return result;
}
@AutoLog(value = "药剂结算单详情-导出:(供应商)送货单以及物资验收单")
@ApiOperation(value="药剂结算单详情-导出:(供应商)送货单以及物资验收单", notes="药剂结算单详情-导出:送货单以及物资验收单")
@GetMapping(value = "/exportWaterDepartSupplierFormPDF")
public Result<ErpSettlementFormVO> exportWaterDepartSupplierFormPDF(@RequestParam(name="id",required=true) String id) {
Result<ErpSettlementFormVO> result = new Result<ErpSettlementFormVO>();
ErpSettlementFormVO erpSettlement = erpSettlementService.queryWaterDepartSettlementFormById(id);
if(erpSettlement==null) {
result.error500("未找到对应实体");
}else {
......
......@@ -3,6 +3,8 @@ package com.skua.modules.erp.mapper;
import java.util.List;
import com.skua.modules.erp.entity.ErpSettlementItem;
import com.skua.modules.erp.vo.ErpSettlementFormVO;
import com.skua.modules.erp.vo.ErpSettlementItemVO;
import com.skua.modules.erp.vo.ErpSettlementVO;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.erp.entity.ErpSettlement;
......@@ -22,4 +24,10 @@ public interface ErpSettlementMapper extends BaseMapper<ErpSettlement> {
// 根据入库单ids,获取【水厂】结算单详情
List<ErpSettlementItem> queryWaterDepartSettlementByMaterialIds(@Param("ids") String materialIds);
//送货单以及物资验收单
List<ErpSettlementItemVO> querySettlementFormById(@Param("id")String id);
//(供应商)送货单以及物资验收单
List<ErpSettlementItemVO> querySupplierSettlementFormById(@Param("id")String id);
//(水厂) 送货单以及物资验收单
List<ErpSettlementItemVO> queryWaterDepartSettlementFormById((@Param("id")String id);
}
......
......@@ -3,6 +3,7 @@ package com.skua.modules.erp.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.skua.modules.erp.vo.AgentiaStatisticsVO;
import com.skua.modules.erp.vo.ArrivalRecordExcelExportVO;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.erp.entity.MaterialIN;
......@@ -26,5 +27,6 @@ public interface MaterialINMapper extends BaseMapper<MaterialIN> {
* @param materialIN
* @return
*/
public List<MaterialIN> selectAuditMaterialINByPage(IPage<MaterialIN> page, @Param("materialIN") MaterialIN materialIN);
List<MaterialIN> selectAuditMaterialINByPage(IPage<MaterialIN> page, @Param("materialIN") MaterialIN materialIN);
}
......
......@@ -48,4 +48,30 @@
and mi.id in (${ids})
order by mi.arrive_time asc
</select>
<select id="querySupplierSettlementFormById" resultType="com.skua.modules.erp.voErpSettlementItemVO">
select d.depart_name,pc.project_name ,pc.contract_code,sm.supp_name as supplier_name,mi.arrive_time, maf.appearance_info ,maf.matched_info ,maf.handle_msg ,maf.sender_sign ,maf.receiver_sign ,aaa.*
from (
select si.sparepart_name,si.material_num,si.specification,si.measuring_unit,s.purchase_contract_id,s.supplier_id,si.material_in_id
from erp_settlement s ,erp_settlement_item si where s.id = si.settlement_id and s.id = #{id}
)aaa
left join erp_purchase_contract pc on aaa.purchase_contract_id = pc.id
left join ajh_supplier_manage sm on aaa.supplier_id = sm.id
left join erp_material_in mi on mi.id = aaa.material_in_id
left join erp_material_acceptance_form maf on maf.id= aaa.material_in_id
left join sys_depart d on d.id = mi.depart_id
</select>
<select id="queryWaterDepartSettlementFormById" resultType="com.skua.modules.erp.voErpSettlementItemVO">
select d.depart_name,dc.contract_code,dc.contract_name as project_name ,mi.arrive_time, maf.appearance_info ,maf.matched_info ,maf.handle_msg ,maf.sender_sign ,maf.receiver_sign ,aaa.*
from (
select si.sparepart_name,si.material_num,si.specification,si.measuring_unit,
s.distribut_contract_id,s.supplier_id,si.material_in_id
from erp_settlement s ,erp_settlement_item si where s.id = si.settlement_id and s.id = #{id}
)aaa
left join erp_distribut_contract dc on aaa.distribut_contract_id = dc.id
left join erp_material_in mi on mi.id = aaa.material_in_id
left join erp_material_acceptance_form maf on maf.id= aaa.material_in_id
left join sys_depart d on d.id = mi.depart_id
</select>
</mapper>
......
......@@ -3,6 +3,7 @@ package com.skua.modules.erp.service;
import com.skua.modules.erp.entity.ErpSettlement;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.erp.entity.ErpSettlementItem;
import com.skua.modules.erp.vo.ErpSettlementFormVO;
import com.skua.modules.erp.vo.ErpSettlementVO;
import org.apache.ibatis.annotations.Param;
......@@ -40,5 +41,9 @@ public interface IErpSettlementService extends IService<ErpSettlement> {
List<ErpSettlementVO> waterDepartSettlement(String materialInIds);
// 根据入库单ids,获取【水厂】结算单详情
List<ErpSettlementItem> queryWaterDepartSettlementByMaterialIds( String materialInIds);
// (供应商)送货单以及物资验收单
ErpSettlementFormVO querySupplierSettlementFormById(String id);
//(水厂) 送货单以及物资验收单
ErpSettlementFormVO queryWaterDepartSettlementFormById(String id);
}
......
......@@ -8,10 +8,13 @@ import com.skua.modules.erp.entity.ErpSettlementItem;
import com.skua.modules.erp.mapper.ErpSettlementItemMapper;
import com.skua.modules.erp.mapper.ErpSettlementMapper;
import com.skua.modules.erp.service.IErpSettlementService;
import com.skua.modules.erp.vo.ErpSettlementFormVO;
import com.skua.modules.erp.vo.ErpSettlementItemVO;
import com.skua.modules.erp.vo.ErpSettlementVO;
import com.skua.modules.system.entity.SysDepart;
import com.skua.modules.system.mapper.SysDepartMapper;
import com.skua.tool.util.JSUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -68,12 +71,17 @@ public class ErpSettlementServiceImpl extends ServiceImpl<ErpSettlementMapper, E
//根据编号查询结算单
public ErpSettlementVO queryById(String id){
ErpSettlementVO erpSettlementVO =(ErpSettlementVO) this.baseMapper.selectById(id);
ErpSettlement erpSettlement = this.baseMapper.selectById(id);
QueryWrapper<ErpSettlementItem> queryWrapper = new QueryWrapper<ErpSettlementItem>();
queryWrapper.eq("settlement_id",id);
List<ErpSettlementItem> settlementItemList = settlementItemMapper.selectList(queryWrapper);
ErpSettlementVO erpSettlementVO = new ErpSettlementVO();
if(erpSettlementVO != null )erpSettlementVO.setItemList( settlementItemList );
if(erpSettlement != null ){
//BeanUtils.copyProperties(有值的对象, 要被赋值的对象);
BeanUtils.copyProperties(erpSettlement, erpSettlementVO);
erpSettlementVO.setItemList( settlementItemList );
}
return erpSettlementVO;
}
......@@ -102,4 +110,40 @@ public class ErpSettlementServiceImpl extends ServiceImpl<ErpSettlementMapper, E
public List<ErpSettlementItem> queryWaterDepartSettlementByMaterialIds( String materialInIds){
return this.baseMapper.queryWaterDepartSettlementByMaterialIds( materialInIds );
}
// 送货单以及物资验收单
public ErpSettlementFormVO querySupplierSettlementFormById(String id){
List<ErpSettlementItemVO> itemList = this.baseMapper.querySupplierSettlementFormById( id );
ErpSettlementFormVO erpSettlementFormVO = new ErpSettlementFormVO();
if(itemList != null && !itemList.isEmpty()){
for(ErpSettlementItemVO settlementFormVO: itemList){
erpSettlementFormVO.setContractCode(settlementFormVO.getContractCode());
erpSettlementFormVO.setDepartName(settlementFormVO.getDepartName());
erpSettlementFormVO.setProjectName(settlementFormVO.getProjectName());
erpSettlementFormVO.setSparepartName(settlementFormVO.getSparepartName());
erpSettlementFormVO.setSpecification(settlementFormVO.getSpecification());
erpSettlementFormVO.setSupplierName(settlementFormVO.getSupplierName());
//erpSettlementFormVO.setSparepartTypeName(settlementFormVO.getSparepartName());
}
}
erpSettlementFormVO.setItemList(itemList );
return erpSettlementFormVO;
}
//(水厂) 送货单以及物资验收单
public ErpSettlementFormVO queryWaterDepartSettlementFormById(String id){
List<ErpSettlementItemVO> itemList = this.baseMapper.queryWaterDepartSettlementFormById( id );
ErpSettlementFormVO erpSettlementFormVO = new ErpSettlementFormVO();
if(itemList != null && !itemList.isEmpty()){
for(ErpSettlementItemVO settlementFormVO: itemList){
erpSettlementFormVO.setContractCode(settlementFormVO.getContractCode());
erpSettlementFormVO.setDepartName(settlementFormVO.getDepartName());
erpSettlementFormVO.setProjectName(settlementFormVO.getProjectName());
erpSettlementFormVO.setSparepartName(settlementFormVO.getSparepartName());
erpSettlementFormVO.setSpecification(settlementFormVO.getSpecification());
erpSettlementFormVO.setSupplierName(settlementFormVO.getSupplierName());
//erpSettlementFormVO.setSparepartTypeName(settlementFormVO.getSparepartName());
}
}
erpSettlementFormVO.setItemList(itemList );
return erpSettlementFormVO;
}
}
......
package com.skua.modules.erp.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.skua.core.util.ConvertUtils;
import com.skua.tool.util.JSUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 药剂结算单详情
*/
@Data
@ApiModel(value="AgentiaStatistics药剂统计对象", description="药剂统计对象")
public class AgentiaStatisticsVO {
@ApiModelProperty(value = "供应商名称")
private String supplierName;
@ApiModelProperty(value = "部门名称")
private String departName;
@ApiModelProperty(value = "物料名称")
private String sparepartName;
@ApiModelProperty(value = "计划数量")
private String planNum;
@ApiModelProperty(value = "供货数量")
private String materialNum;
@TableField(exist=false)
@ApiModelProperty(value = "剩余数量")
private String leaveNum;
public String getLeaveNum() {
leaveNum = JSUtils.format(ConvertUtils.getDouble( this.planNum,0d ) - ConvertUtils.getDouble(this.materialNum,0d));
return leaveNum;
}
}
package com.skua.modules.erp.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -43,7 +42,6 @@ public class ErpSettlementFormVO {
@ApiModelProperty(value = "规格型号")
private String specification;
@TableField(exist=false)
@ApiModelProperty(value = "结算清单")
private List<ErpSettlementItemVO> itemList ;
......
package com.skua.modules.erp.vo;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.skua.modules.erp.entity.ErpSettlementItem;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* 药剂结算单详情
*/
@Data
@ApiModel(value="erp_settlement_item数据传输对象", description="药剂结算单详情")
public class ErpSettlementItemVO extends ErpSettlementItem {
@ApiModelProperty(value = "合同编号")
private String contractCode;
@ApiModelProperty(value = "物料名称")
private String sparepartName;
@ApiModelProperty(value = "规格型号")
private String specification;
@ApiModelProperty(value = "项目名称")
private String projectName;
@ApiModelProperty(value = "供应商名称")
private String supplierName;
@ApiModelProperty(value = "部门名称")
private String departName;
/**外观情况*/
@ApiModelProperty(value = "外观情况")
private String appearanceInfo;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!