1.修复部分bug,添加养护记录打印功能

zhairh
x_z 2 years ago
parent 2831601d9d
commit 867d1d2287

@ -1,12 +1,20 @@
package com.glxp.api.admin.controller.inventory; package com.glxp.api.admin.controller.inventory;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glxp.api.admin.annotation.AuthRuleAnnotation;
import com.glxp.api.admin.entity.info.SystemPDFModuleEntity;
import com.glxp.api.admin.entity.info.SystemPDFTemplateEntity;
import com.glxp.api.admin.entity.inventory.DeviceMAOrderEntity; import com.glxp.api.admin.entity.inventory.DeviceMAOrderEntity;
import com.glxp.api.admin.req.info.SystemPDFModuleRequest;
import com.glxp.api.admin.req.inventory.AddDeviceMAOrderRequest; import com.glxp.api.admin.req.inventory.AddDeviceMAOrderRequest;
import com.glxp.api.admin.req.inventory.FilterDeviceMAOrderRequest; import com.glxp.api.admin.req.inventory.FilterDeviceMAOrderRequest;
import com.glxp.api.admin.req.itextpdf.InspectionPDFTemplateRequest;
import com.glxp.api.admin.res.PageSimpleResponse; import com.glxp.api.admin.res.PageSimpleResponse;
import com.glxp.api.admin.res.inventory.DeviceMAOrderResponse; import com.glxp.api.admin.res.inventory.DeviceMAOrderResponse;
import com.glxp.api.admin.service.info.SystemPDFModuleService;
import com.glxp.api.admin.service.info.SystemPDFTemplateService;
import com.glxp.api.admin.service.inventory.DeviceMAOrderService; import com.glxp.api.admin.service.inventory.DeviceMAOrderService;
import com.glxp.api.admin.util.JasperUtils;
import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.common.util.ResultVOUtils;
@ -18,7 +26,10 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* *
@ -29,6 +40,11 @@ public class DeviceMAOrderController {
@Resource @Resource
private DeviceMAOrderService deviceMAOrderService; private DeviceMAOrderService deviceMAOrderService;
@Resource
private SystemPDFTemplateService systemPDFTemplateService;
@Resource
private SystemPDFModuleService systemPDFModuleService;
/** /**
* *
@ -109,5 +125,49 @@ public class DeviceMAOrderController {
return deviceMAOrderService.addDeviceMAOrder(addDeviceMAOrderRequest); return deviceMAOrderService.addDeviceMAOrder(addDeviceMAOrderRequest);
} }
/**
*
*
* @param inspectionPDFTemplateRequest
* @return
*/
@AuthRuleAnnotation("")
@PostMapping("/device/MA/order/verifyTemplateFile")
public BaseResponse verifyTemplateFile(@RequestBody InspectionPDFTemplateRequest inspectionPDFTemplateRequest) {
if (null == inspectionPDFTemplateRequest) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "参数不能为空!");
}
//查询模板文件是否存在
SystemPDFModuleRequest systemPDFModuleRequest = new SystemPDFModuleRequest();
systemPDFModuleRequest.setId(inspectionPDFTemplateRequest.getModuleId());
SystemPDFModuleEntity systemPDFModule = systemPDFModuleService.findSystemPDFModule(systemPDFModuleRequest);
if (null == systemPDFModule) {
return ResultVOUtils.error(ResultEnum.DATA_NOT, "所属模块错误");
}
SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(String.valueOf(systemPDFModule.getTemplateId()));
if (null == systemPDFTemplateEntity) {
return ResultVOUtils.error(ResultEnum.DATA_NOT, "模板错误");
}
return ResultVOUtils.success(systemPDFModule.getTemplateId());
}
/**
*
*
* @param filterDeviceMAOrderRequest
* @param request
* @param response
* @throws Exception
*/
@AuthRuleAnnotation("")
@PostMapping("/device/MA/order/pintOrder")
public void printOrder(@RequestBody FilterDeviceMAOrderRequest filterDeviceMAOrderRequest, HttpServletRequest request, HttpServletResponse response) throws Exception {
SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(filterDeviceMAOrderRequest.getTemplateId());
//查询打印数据
Map<String, Object> data = deviceMAOrderService.getPrintData(filterDeviceMAOrderRequest.getOrderId());
JasperUtils.jasperReport(request, response, data, systemPDFTemplateEntity.getPath(), "pdf");
}
} }

@ -59,5 +59,11 @@ public interface UdiInfoDao {
*/ */
void updateUdiInfoByUuid(UdiInfoEntity udiInfoEntity); void updateUdiInfoByUuid(UdiInfoEntity udiInfoEntity);
/**
* ID
*
* @param productId
* @return
*/
String selectProductNameByProductId(@Param("productId") String productId);
} }

@ -5,6 +5,7 @@ import com.glxp.api.admin.entity.inventory.DeviceMAOrderEntity;
import com.glxp.api.admin.req.inventory.FilterDeviceMAOrderRequest; import com.glxp.api.admin.req.inventory.FilterDeviceMAOrderRequest;
import com.glxp.api.admin.res.inventory.DeviceMAOrderResponse; import com.glxp.api.admin.res.inventory.DeviceMAOrderResponse;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -24,4 +25,12 @@ public interface DeviceMAOrderDao {
int updateByPrimaryKey(DeviceMAOrderEntity record); int updateByPrimaryKey(DeviceMAOrderEntity record);
List<DeviceMAOrderResponse> filterList(FilterDeviceMAOrderRequest filterDeviceMAOrderRequest); List<DeviceMAOrderResponse> filterList(FilterDeviceMAOrderRequest filterDeviceMAOrderRequest);
/**
*
*
* @param orderId
* @return
*/
DeviceMAOrderEntity selectByOrderId(@Param("orderId") String orderId);
} }

@ -31,4 +31,9 @@ public class FilterDeviceMAOrderRequest extends ListPageRequest {
*/ */
private String code; private String code;
/**
* ID
*/
private String templateId;
} }

@ -7,6 +7,7 @@ import com.glxp.api.admin.res.inventory.DeviceMAOrderResponse;
import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.res.BaseResponse;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Service * Service
@ -52,4 +53,12 @@ public interface DeviceMAOrderService {
* @return * @return
*/ */
BaseResponse addDeviceMAOrder(AddDeviceMAOrderRequest addDeviceMAOrderRequest); BaseResponse addDeviceMAOrder(AddDeviceMAOrderRequest addDeviceMAOrderRequest);
/**
*
*
* @param orderId
* @return
*/
Map<String, Object> getPrintData(String orderId);
} }

@ -3,6 +3,7 @@ package com.glxp.api.admin.service.inventory.impl;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.glxp.api.admin.constant.Constant; import com.glxp.api.admin.constant.Constant;
import com.glxp.api.admin.dao.basic.UdiInfoDao;
import com.glxp.api.admin.dao.inventory.DeviceCollectOrderDetailDao; import com.glxp.api.admin.dao.inventory.DeviceCollectOrderDetailDao;
import com.glxp.api.admin.dao.inventory.DeviceMAOrderDao; import com.glxp.api.admin.dao.inventory.DeviceMAOrderDao;
import com.glxp.api.admin.dao.inventory.DeviceMaOrderDetailDao; import com.glxp.api.admin.dao.inventory.DeviceMaOrderDetailDao;
@ -26,7 +27,9 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@Slf4j @Slf4j
@Service @Service
@ -43,6 +46,8 @@ public class DeviceMAOrderServiceImpl implements DeviceMAOrderService {
private DeviceCollectOrderDetailDao deviceCollectOrderDetailDao; private DeviceCollectOrderDetailDao deviceCollectOrderDetailDao;
@Resource @Resource
private DeviceMaOrderDetailDao deviceMaOrderDetailDao; private DeviceMaOrderDetailDao deviceMaOrderDetailDao;
@Resource
private UdiInfoDao udiInfoDao;
@Override @Override
public List<DeviceMAOrderResponse> filterList(FilterDeviceMAOrderRequest filterDeviceMAOrderRequest) { public List<DeviceMAOrderResponse> filterList(FilterDeviceMAOrderRequest filterDeviceMAOrderRequest) {
@ -166,4 +171,34 @@ public class DeviceMAOrderServiceImpl implements DeviceMAOrderService {
return ResultVOUtils.success(); return ResultVOUtils.success();
} }
@Override
public Map<String, Object> getPrintData(String orderId) {
DeviceMAOrderEntity deviceMAOrderEntity = deviceMAOrderDao.selectByOrderId(orderId);
List<DeviceMAOrderDetailEntity> detailList = deviceMaOrderDetailDao.selectByOrderId(orderId);
DeviceMAOrderDetailEntity deviceMAOrderDetailEntity = detailList.get(0);
Map<String, Object> data = new HashMap<>(10);
//养护记录号
data.put("orderId", orderId);
//设备号
data.put("code", deviceMAOrderDetailEntity.getCode());
//设备名称
String productName = udiInfoDao.selectProductNameByProductId(deviceMAOrderDetailEntity.getProductId());
data.put("productName", productName);
//批次号
data.put("batchNo", deviceMAOrderDetailEntity.getBatchNo());
//养护时间
data.put("createTime", deviceMAOrderEntity.getCreateTime());
//养护人
data.put("createUser", deviceMAOrderEntity.getCreateUser());
//审核人
data.put("auditUser", deviceMAOrderEntity.getAuditUser());
//养护说明
data.put("remark", deviceMAOrderDetailEntity.getRemark());
//设备状态
data.put("deviceStatus", deviceMAOrderDetailEntity.getDeviceStatus() == 0 ? "异常" : "正常");
//养护状态
data.put("maintenanceStatus", deviceMAOrderDetailEntity.getMaintenanceStatus() == 0 ? "未养护" : "已养护");
return data;
}
} }

@ -80,6 +80,7 @@ public class InvMAOrderServiceImpl implements InvMAOrderService {
} }
//复制新数据 //复制新数据
BeanUtil.copyProperties(invMaintenanceOrder, maintenanceOrder, "id", "createTime", "createUser"); BeanUtil.copyProperties(invMaintenanceOrder, maintenanceOrder, "id", "createTime", "createUser");
maintenanceOrder.setUpdateTime(com.glxp.api.admin.util.DateUtil.getTime());
invMAOrderDao.updateByPrimaryKey(maintenanceOrder); invMAOrderDao.updateByPrimaryKey(maintenanceOrder);
return ResultVOUtils.success("更新成功"); return ResultVOUtils.success("更新成功");
} }

@ -363,4 +363,9 @@
#{item.scbssfbhsxrq},#{item.cpms},#{item.originUuid},#{allowNoBatch},#{allowNoExpire},#{allowNoProduct}) #{item.scbssfbhsxrq},#{item.cpms},#{item.originUuid},#{allowNoBatch},#{allowNoExpire},#{allowNoProduct})
</foreach> </foreach>
</insert> </insert>
<select id="selectProductNameByProductId" resultType="java.lang.String">
select cpmctymc from basic_products
where uuid = (select uuid from basic_udirel where id = #{productId})
</select>
</mapper> </mapper>

@ -150,7 +150,14 @@
</update> </update>
<select id="filterList" resultType="com.glxp.api.admin.res.inventory.DeviceMAOrderResponse"> <select id="filterList" resultType="com.glxp.api.admin.res.inventory.DeviceMAOrderResponse">
select dmo.*, dmod.code select dmo.id,
dmo.createUser,
dmo.collOrderId,
dmo.orderId,
dmo.status,
dmo.createTime,
dmod.code,
dmod.remark
from device_ma_order dmo from device_ma_order dmo
left join device_ma_order_detail dmod on dmo.orderId = dmod.orderIdFk left join device_ma_order_detail dmod on dmo.orderId = dmod.orderIdFk
<where> <where>
@ -167,5 +174,11 @@
AND dmod.code like concat('%', #{code}, '%') AND dmod.code like concat('%', #{code}, '%')
</if> </if>
</where> </where>
order by dmo.createTime desc
</select>
<select id="selectByOrderId" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from device_ma_order where orderId = #{orderId}
</select> </select>
</mapper> </mapper>

@ -83,3 +83,10 @@ drop table if exists auth_platform;
-- 删除医院客户和自助平台关联表 -- 删除医院客户和自助平台关联表
drop table if exists io_unit_maintain_platform; drop table if exists io_unit_maintain_platform;
-- 添加设备养护单模板记录
REPLACE INTO `system_pdf_template` (`id`, `name`, `type`, `module`, `param`, `path`, `rowCount`, `qrcodeCount`, `remark`, `create_time`, `update_time`, `jrxmlPath`) VALUES (17, '设备养护单', 2, 2, '', 'D:/udi/udiwms/udiwmsfile//pdf/template/b914bb90-2dc9-4463-9d07-70b5e44f13bb.jasper', 10, 1, '', '2022-05-12 12:18:21', '2022-06-27 15:20:10', 'D:/udi/udiwms/udiwmsfile//pdf/template/3da2d665-8a31-4fac-84d4-f7b69f5cc846.jrxml');
REPLACE INTO system_pdf_module (`id`, `name`, `param`, `fieldExplain`, `remark`, `templateId`, `create_time`, `update_time`, `templateDlUrl`, `templateType`, `remark1`, `remark2`, `remark3` )
VALUES
( 7, '单据管理-设备养护记录-单据打印', '', ' orderId 养护记录号\r\n code 设备号\r\n productName 设备名称\r\n batchNo 批次号\r\n createTime 养护时间\r\n createUser 养护人\r\n auditUser 审核人\r\n remark 养护说明\r\n deviceStatus 设备状态\r\n maintenanceStatus 养护状态\r\n remark1 备注字段1\r\n remark2 备注字段2\r\n remark3 备注字段3', NULL, 17, '2022-04-08 14:05:07', '2022-04-08 14:05:10', 'D://1s/udiwms/pdftemplate/stock_order_demo.jrxml', 2, NULL, NULL, NULL );

Loading…
Cancel
Save