feat: 0527开发论证功能
parent
b70f4136cf
commit
a15afd2f5a
@ -0,0 +1,120 @@
|
||||
package com.glxp.api.controller.purchase;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.glxp.api.annotation.AuthRuleAnnotation;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.common.util.ResultVOUtils;
|
||||
import com.glxp.api.entity.purchase.PurApplyArgument;
|
||||
import com.glxp.api.entity.purchase.PurInquiryItemEntity;
|
||||
import com.glxp.api.entity.system.SystemPDFTemplateEntity;
|
||||
import com.glxp.api.req.dev.DeviceInfoDetailQuery;
|
||||
import com.glxp.api.req.purchase.PurApplyArgumentRequest;
|
||||
import com.glxp.api.req.purchase.PurInquiryOfferRequest;
|
||||
import com.glxp.api.res.PageSimpleResponse;
|
||||
import com.glxp.api.res.purchase.PurInquiryOfferEntityResponse;
|
||||
import com.glxp.api.service.purchase.impl.PurApplyArgumentService;
|
||||
import com.glxp.api.service.system.SystemPDFTemplateService;
|
||||
import com.glxp.api.util.EntityToMapConverter;
|
||||
import com.glxp.api.util.JasperUtils;
|
||||
import com.glxp.api.vo.dev.DeviceInfoVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.sf.jasperreports.engine.JRException;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.IOException;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
public class PurApplyArgumentController {
|
||||
|
||||
@Resource
|
||||
PurApplyArgumentService purApplyArgumentService;
|
||||
@Resource
|
||||
private SystemPDFTemplateService systemPDFTemplateService;
|
||||
@Value("${file_path}")
|
||||
private String filePath;
|
||||
|
||||
/**
|
||||
* 查询询价业务列表
|
||||
*/
|
||||
@GetMapping("/purchase/purApplyArgument/list")
|
||||
public BaseResponse list(PurApplyArgumentRequest purApplyArgumentRequest) {
|
||||
|
||||
List<PurApplyArgument> list = purApplyArgumentService.queryPageList(purApplyArgumentRequest);
|
||||
PageInfo<PurApplyArgument> pageInfo;
|
||||
pageInfo = new PageInfo<>(list);
|
||||
PageSimpleResponse<PurApplyArgument> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
pageSimpleResponse.setList(list);
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@PostMapping("/purchase/purApplyArgument/updateArg")
|
||||
public BaseResponse updateArg(@RequestBody PurApplyArgument purApplyArgument) {
|
||||
purApplyArgumentService.updateById(purApplyArgument);
|
||||
return ResultVOUtils.success("修改成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 论证单明细打印
|
||||
*
|
||||
* @param purApplyArgumentRequest
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/purchase/purApplyArgument/printArg")
|
||||
public BaseResponse printArg(@RequestBody PurApplyArgumentRequest purApplyArgumentRequest, HttpServletRequest request, HttpServletResponse response) throws JRException, IOException {
|
||||
List<PurApplyArgument> resList = new ArrayList<>();
|
||||
SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(purApplyArgumentRequest.getTemplateId());
|
||||
//打印单号标签
|
||||
Map<String, Object> data = new HashMap<>(1);
|
||||
List<Object> list = new ArrayList<>();
|
||||
|
||||
//按选入打印
|
||||
if (purApplyArgumentRequest.getList() != null && purApplyArgumentRequest.getList().size() > 0) {
|
||||
resList = purApplyArgumentRequest.getList();
|
||||
} else {
|
||||
resList = purApplyArgumentService.queryPageList(purApplyArgumentRequest);
|
||||
}
|
||||
int i = 1;
|
||||
for (PurApplyArgument item : resList) {
|
||||
//组装数据
|
||||
Map<String, Object> purApplyArgumentData = EntityToMapConverter.convertEntityToMap(item);
|
||||
purApplyArgumentData.put("index", String.valueOf(i));
|
||||
list.add(purApplyArgumentData);
|
||||
i++;
|
||||
}
|
||||
data.put("data", list);
|
||||
String param = JSON.toJSONString(data);
|
||||
JasperUtils.jasperReport(request, response, param, filePath + "pdf/template/" + systemPDFTemplateEntity.getPath(), "pdf");
|
||||
return ResultVOUtils.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查看是否全部通过
|
||||
*
|
||||
* @param id 主键串
|
||||
*/
|
||||
@GetMapping("/purchase/purApplyArgument/argAllPass/{id}")
|
||||
public BaseResponse argAllPass(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
int data = purApplyArgumentService.argAllPass(id);
|
||||
return ResultVOUtils.success(data);
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.glxp.api.req.purchase;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.glxp.api.entity.purchase.PurApplyArgument;
|
||||
import com.glxp.api.util.page.ListPageRequest;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PurApplyArgumentRequest extends ListPageRequest {
|
||||
|
||||
|
||||
/**
|
||||
* 询价单据号
|
||||
*/
|
||||
private String applyBillNo;
|
||||
|
||||
/**
|
||||
* 论证状态
|
||||
*/
|
||||
private Integer argStatus;
|
||||
|
||||
/**
|
||||
* 申购负责人
|
||||
*/
|
||||
private String createName;
|
||||
|
||||
/**
|
||||
* 产品名字
|
||||
*/
|
||||
private String productName;
|
||||
|
||||
private Long deptCode;
|
||||
|
||||
@TableField(value = "pageType")
|
||||
private Integer pageType;
|
||||
|
||||
private String templateId;
|
||||
|
||||
private List<PurApplyArgument> list;
|
||||
}
|
Loading…
Reference in New Issue