数据接口

This commit is contained in:
haozq 2024-11-12 11:22:34 +08:00
parent a1b9b2cfb3
commit afd057cc14
11 changed files with 153 additions and 15 deletions

View File

@ -2,6 +2,7 @@ package com.bonus.gzgqj.business.bases.controller;
import com.bonus.gzgqj.business.bases.entity.PaTypeVo;
import com.bonus.gzgqj.business.bases.entity.PartInputVo;
import com.bonus.gzgqj.business.bases.entity.VendVo;
import com.bonus.gzgqj.business.bases.service.PaTypeService;
import com.bonus.gzgqj.business.plan.entity.PlanApplyAuditBean;
import com.bonus.gzgqj.manager.annotation.DecryptAndVerify;
@ -88,4 +89,16 @@ public class PaTypeController {
return pageInfo;
}
/**
* 厂家下拉选
* @param dto
* @return
*/
@GetMapping("getVendList")
@DecryptAndVerify(decryptedClass = VendVo.class)
public ServerResponse getVendList(EncryptedReq<VendVo> dto) {
return service.getVendList(dto.getData());
}
}

View File

@ -5,14 +5,15 @@ import com.bonus.gzgqj.business.bases.service.PartInputService;
import com.bonus.gzgqj.business.plan.entity.PlanApplyBean;
import com.bonus.gzgqj.manager.annotation.DecryptAndVerify;
import com.bonus.gzgqj.manager.core.entity.EncryptedReq;
import com.bonus.gzgqj.manager.webResult.ServerResponse;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
@ -42,8 +43,14 @@ public class PartInputController {
}
/**
* 配件入库接口
* @return
*/
@PostMapping("addInputData")
public ServerResponse addInputData(HttpServletRequest request, @RequestParam("file[]") MultipartFile[] files) {
return service.addInputData(request,files);
}

View File

@ -52,4 +52,10 @@ public class PartInputDetails {
* 配件类型
*/
private String partmodel;
/**
* 配件类型
*/
private String partUnit;
}

View File

@ -3,6 +3,8 @@ package com.bonus.gzgqj.business.bases.entity;
import lombok.Data;
import org.apache.poi.hpsf.Decimal;
import java.util.List;
/**
* @author 黑子
* 入库管理
@ -72,4 +74,7 @@ public class PartInputVo {
*/
private String keyWord;
private List<PartInputDetails> details;
}

View File

@ -0,0 +1,30 @@
package com.bonus.gzgqj.business.bases.entity;
import lombok.Data;
/**
* @author 黑子
* 厂家
*/
@Data
public class VendVo {
private String id;
/**
* 名称
*/
private String name;
/**
* 地址
*/
private String address;
private String companyMan;
/**
* 手机号
*/
private String phone;
}

View File

@ -1,6 +1,7 @@
package com.bonus.gzgqj.business.bases.mapper;
import com.bonus.gzgqj.business.bases.entity.PaTypeVo;
import com.bonus.gzgqj.business.bases.entity.VendVo;
import io.lettuce.core.dynamic.annotation.Param;
import org.springframework.stereotype.Repository;
@ -52,5 +53,17 @@ public interface PaTypeMapper {
*/
int getActByName(PaTypeVo data);
/**
* 分页查询 配件
* @param data
* @return
*/
List<PaTypeVo> findByPage(PaTypeVo data);
/**
* 差价下拉选
* @param data
* @return
*/
List<VendVo> getVendList(VendVo data);
}

View File

@ -1,6 +1,7 @@
package com.bonus.gzgqj.business.bases.service;
import com.bonus.gzgqj.business.bases.entity.PaTypeVo;
import com.bonus.gzgqj.business.bases.entity.VendVo;
import com.bonus.gzgqj.manager.webResult.ServerResponse;
import lombok.extern.slf4j.Slf4j;
@ -45,4 +46,6 @@ public interface PaTypeService {
* @return
*/
List<PaTypeVo> findByPage(PaTypeVo data);
ServerResponse getVendList(VendVo data);
}

View File

@ -1,6 +1,7 @@
package com.bonus.gzgqj.business.bases.service;
import com.bonus.gzgqj.business.bases.entity.PaTypeVo;
import com.bonus.gzgqj.business.bases.entity.VendVo;
import com.bonus.gzgqj.business.bases.mapper.PaTypeMapper;
import com.bonus.gzgqj.manager.webResult.ServerResponse;
import lombok.extern.slf4j.Slf4j;
@ -61,19 +62,20 @@ public class PaTypeServiceImpl implements PaTypeService{
}
data.setLevel(level);
}
int nums=mapper.getActByName(data);
if(nums>0){
return ServerResponse.createErroe("该节点名称已存在");
}
int nums=mapper.getActByName(data);
if(nums>0){
return ServerResponse.createErroe("该节点名称已存在");
}else{
int num= mapper.addTypeData(data);
if(num>0){
return ServerResponse.createSuccess("添加成功",data);
}else{
int num= mapper.addTypeData(data);
if(num>0){
return ServerResponse.createSuccess("添加成功",data);
}else{
return ServerResponse.createErroe("添加失败");
}
return ServerResponse.createErroe("添加失败");
}
}
}catch (Exception e){
log.error(e.toString(),e);
}
@ -156,5 +158,21 @@ public class PaTypeServiceImpl implements PaTypeService{
return list;
}
/**
* 查询厂家下拉选
* @param data
* @return
*/
@Override
public ServerResponse getVendList(VendVo data) {
List<VendVo> list=new ArrayList<>();
try{
list=mapper.getVendList(data);
}catch (Exception e){
log.error(e.toString(),e);
}
return ServerResponse.createSuccess(list);
}
}

View File

@ -1,7 +1,10 @@
package com.bonus.gzgqj.business.bases.service;
import com.bonus.gzgqj.business.bases.entity.PartInputVo;
import com.bonus.gzgqj.manager.webResult.ServerResponse;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
@ -14,4 +17,12 @@ public interface PartInputService {
* @return
*/
List<PartInputVo> findByPage(PartInputVo data);
/**
* 配件入库接口
* @param request
* @param files
* @return
*/
ServerResponse addInputData(HttpServletRequest request, MultipartFile[] files);
}

View File

@ -1,12 +1,17 @@
package com.bonus.gzgqj.business.bases.service;
import com.alibaba.fastjson.JSON;
import com.bonus.gzgqj.business.bases.entity.PartInputVo;
import com.bonus.gzgqj.business.bases.mapper.PartInputMapper;
import com.bonus.gzgqj.business.plan.entity.ProOutInfoVo;
import com.bonus.gzgqj.manager.common.util.StringHelper;
import com.bonus.gzgqj.manager.webResult.ServerResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
@ -40,4 +45,26 @@ public class PartInputServiceImpl implements PartInputService{
}
return list;
}
/**
* 配件入库接口
* @param request
* @param files
* @return
*/
@Override
public ServerResponse addInputData(HttpServletRequest request, MultipartFile[] files) {
try{
String params=request.getParameter("params");
PartInputVo vo= JSON.parseObject(params,PartInputVo.class);
}catch (Exception e){
}
return null;
}
}

View File

@ -42,7 +42,7 @@
<!--分页查询 节点数据-->
<select id="findByPage" resultType="com.bonus.gzgqj.business.bases.entity.PaTypeVo">
select pt.id, pt.parent_id parentId,pt.name model ,pt.num,
pt.price,pt.unit,pt.weight,pt.is_consumables ,
pt.price,pt.unit ,pt.weight,pt.is_consumables ,
pt.remarks,pt.is_active ,pt.level,pt.warn_num,pt1.`name` name ,pt2.name type
FROM pa_type pt
left join pa_type pt1 on pt.parent_id=pt1.id and pt1.`level`=2 and pt1.is_active=1
@ -60,4 +60,9 @@
</if>
</where>
</select>
<select id="getVendList" resultType="com.bonus.gzgqj.business.bases.entity.VendVo">
SELECT ID id,NAME name
FROM mm_vender
where IS_ACTIVE=1
</select>
</mapper>