| | |
| | | <artifactId>framework</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.poi</groupId> |
| | | <artifactId>poi</artifactId> |
| | | <version>5.2.2</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.deepoove</groupId> |
| | | <artifactId>poi-tl</artifactId> |
| | | <version>1.12.2</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.dto.ReportPageDto; |
| | | import com.yuanchu.mom.dto.SampleOrderDto; |
| | | import com.yuanchu.mom.service.InsReportService; |
| | | import com.yuanchu.mom.utils.JackSonUtil; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @AllArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/insReport") |
| | | @Api("æ£éªæ¥å") |
| | | public class InsReportController { |
| | | |
| | | private InsReportService insReportService; |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢æ£éªæ¥åæ°æ®") |
| | | @PostMapping("/pageInsReport") |
| | | public Result pageInsReport(@RequestBody Map<String, Object> data) throws Exception { |
| | | Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | | ReportPageDto reportPageDto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), ReportPageDto.class); |
| | | return Result.success(insReportService.pageInsReport(page, reportPageDto)); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.dto; |
| | | |
| | | import com.yuanchu.mom.annotation.ValueTableShow; |
| | | import com.yuanchu.mom.common.OrderBy; |
| | | import com.yuanchu.mom.pojo.InsReport; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import javax.validation.constraints.Size; |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | public class ReportPageDto extends InsReport implements Serializable { |
| | | |
| | | @ValueTableShow(2) |
| | | @ApiModelProperty(value = "å§æç¼å·") |
| | | private String entrustCode; |
| | | |
| | | @ValueTableShow(value = 3,name = "ç¼å¶äºº") |
| | | private String updateUserName; |
| | | |
| | | @ValueTableShow(value = 8,name = "æ¹å人") |
| | | private String ratifyUser; |
| | | |
| | | @ValueTableShow(value = 5,name = "å®¡æ ¸äºº") |
| | | private String examineUser; |
| | | |
| | | } |
| | |
| | | package com.yuanchu.mom.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.yuanchu.mom.dto.ReportPageDto; |
| | | import com.yuanchu.mom.dto.SampleOrderDto; |
| | | import com.yuanchu.mom.pojo.InsOrder; |
| | | import com.yuanchu.mom.pojo.InsReport; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | |
| | | */ |
| | | public interface InsReportMapper extends BaseMapper<InsReport> { |
| | | |
| | | IPage<ReportPageDto> pageInsReport(IPage<ReportPageDto> page, QueryWrapper<ReportPageDto> ew); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | import java.util.Date; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.yuanchu.mom.annotation.ValueTableShow; |
| | | import com.yuanchu.mom.common.OrderBy; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | */ |
| | | @TableName(value ="ins_report") |
| | | @Data |
| | | public class InsReport implements Serializable { |
| | | public class InsReport extends OrderBy implements Serializable { |
| | | /** |
| | | * |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ValueTableShow(value = 1, name = "æ¥åç¼å·") |
| | | @ApiModelProperty("æ¥åç¼å·") |
| | | private String code; |
| | | |
| | | /** |
| | | * å¤é®ï¼æ£éªåid |
| | |
| | | /** |
| | | * 1ï¼æ¹å 0ï¼æªæ¹å |
| | | */ |
| | | @ValueTableShow(value = 9, name = "æ¹åç¶æ") |
| | | private Integer isRatify; |
| | | |
| | | @ValueTableShow(value = 10, name = "æ¹å夿³¨") |
| | | private String ratifyTell; |
| | | |
| | | /** |
| | | * 1ï¼å®¡æ ¸ 0ï¼æªå®¡æ ¸ |
| | | */ |
| | | @ValueTableShow(value = 6, name = "å®¡æ ¸ç¶æ") |
| | | private Integer isExamine; |
| | | |
| | | @ValueTableShow(value = 7, name = "å®¡æ ¸å¤æ³¨") |
| | | private String examineTell; |
| | | |
| | | /** |
| | | * å¤é®ï¼ç¨æ·idï¼æ¹åäººï¼ |
| | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ValueTableShow(value = 4, name = "ç¼å¶æ¶é´") |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | |
| | | package com.yuanchu.mom.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.dto.InsOrderPlanDTO; |
| | | import com.yuanchu.mom.dto.ReportPageDto; |
| | | import com.yuanchu.mom.pojo.InsReport; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author Administrator |
| | |
| | | */ |
| | | public interface InsReportService extends IService<InsReport> { |
| | | |
| | | Map<String,Object> pageInsReport(Page page, ReportPageDto reportPageDto); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.deepoove.poi.XWPFTemplate; |
| | | import com.yuanchu.mom.common.GetLook; |
| | | import com.yuanchu.mom.common.PrintChina; |
| | | import com.yuanchu.mom.dto.InsOrderPlanDTO; |
| | |
| | | import com.yuanchu.mom.vo.InsOrderPlanVO; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | for (SampleProductDto samples : list) { |
| | | if (BeanUtil.isEmpty(samples.getInsProduct())) continue; |
| | | for (InsProduct product : samples.getInsProduct()) { |
| | | if (product.getTemplateId() == null) { |
| | | product.setTemplate(new ArrayList<>()); |
| | | continue; |
| | | } |
| | | if(set.add(product.getTemplateId())){ |
| | | map2.put(product.getTemplateId(), standardTemplateService.getStandTempThingById(product.getTemplateId()) + ""); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int verifyPlan(Integer orderId, String laboratory, Integer type, String tell) { |
| | | Integer num = (type==1?5:4); |
| | | return insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate().eq(InsOrderState::getInsOrderId, orderId).eq(InsOrderState::getLaboratory, laboratory).set(InsOrderState::getInsTime, LocalDateTime.now()).set(InsOrderState::getInsState, num).set(InsOrderState::getVerifyTell, tell)); |
| | | insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate().eq(InsOrderState::getInsOrderId, orderId).eq(InsOrderState::getLaboratory, laboratory).set(InsOrderState::getInsTime, LocalDateTime.now()).set(InsOrderState::getInsState, num).set(InsOrderState::getVerifyTell, tell).set(InsOrderState::getVerifyUser, getLook.selectPowerByMethodAndUserId(null).get("userId"))); |
| | | List<InsOrderState> insOrderStates = insOrderStateMapper.selectList(Wrappers.<InsOrderState>lambdaQuery().eq(InsOrderState::getInsOrderId, orderId)); |
| | | long count = insOrderStates.stream().filter(a -> a.getInsState() == 5).count(); |
| | | if (count == insOrderStates.size()) { |
| | | XWPFTemplate template = XWPFTemplate.compile("template.docx").render( |
| | | new HashMap<String, Object>() {{ |
| | | put("title", "Hi, poi-tl Word模æ¿å¼æ"); |
| | | }}); |
| | | try { |
| | | template.writeAndClose(new FileOutputStream("output.docx")); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId)); |
| | | insSamples.forEach(a -> { |
| | | System.out.println(a); |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsSampleId, a.getId())); |
| | | insProducts.forEach(System.out::println); |
| | | }); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | |
| | | package com.yuanchu.mom.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.common.GetLook; |
| | | import com.yuanchu.mom.common.PrintChina; |
| | | import com.yuanchu.mom.dto.InsOrderPlanDTO; |
| | | import com.yuanchu.mom.dto.ReportPageDto; |
| | | import com.yuanchu.mom.dto.SampleOrderDto; |
| | | import com.yuanchu.mom.pojo.InsReport; |
| | | import com.yuanchu.mom.service.InsReportService; |
| | | import com.yuanchu.mom.mapper.InsReportMapper; |
| | | import com.yuanchu.mom.utils.QueryWrappers; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author Administrator |
| | |
| | | * @createDate 2024-03-17 22:10:02 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class InsReportServiceImpl extends ServiceImpl<InsReportMapper, InsReport> |
| | | implements InsReportService{ |
| | | |
| | | private GetLook getLook; |
| | | |
| | | private InsReportMapper insReportMapper; |
| | | |
| | | @Override |
| | | public Map<String, Object> pageInsReport(Page page, ReportPageDto reportPageDto) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("head", PrintChina.printChina(ReportPageDto.class)); |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("pageInsReport"); |
| | | if (map1.get("look") == 1) reportPageDto.setCreateUser(map1.get("userId")); |
| | | map.put("body", insReportMapper.pageInsReport(page, QueryWrappers.queryWrappers(reportPageDto))); |
| | | return map; |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id,ins_order_id,url, |
| | | url_s,is_ratify,is_examine, |
| | | ratify_user_id,examine_user_id,create_user, |
| | | update_user,create_time,update_time |
| | | </sql> |
| | | <select id="pageInsReport" resultType="com.yuanchu.mom.dto.ReportPageDto"> |
| | | select * |
| | | from ( |
| | | select |
| | | ir.*,io.entrust_code,u.name update_user_name,u1.name ratify_user,u2.name examine_user |
| | | from ins_report ir |
| | | left join ins_order io on io.id = ir.ins_order_id |
| | | left join user u on u.id = ir.update_user |
| | | left join user u1 on u1.id = ir.ratify_user_id |
| | | left join user u2 on u2.id = ir.examine_user_id |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | </mapper> |