企业往来单位

master
薛宇 2 years ago
parent 76354d17cc
commit f33ff4f912

@ -7,11 +7,14 @@ import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.basic.BasicCorpEntity;
import com.glxp.api.exception.JsonException;
import com.glxp.api.req.basic.BasicUnitMaintainFilterRequest;
import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.basic.BasicCorpResponse;
import com.glxp.api.service.auth.AuthAdminService;
import com.glxp.api.service.basic.BasicCorpService;
import com.glxp.api.util.CustomUtil;
import org.springframework.beans.BeanUtils;
@ -37,6 +40,8 @@ public class BasicCorpController {
@Resource
private BasicCorpService basicUnitMaintainService;
@Resource
private AuthAdminService authAdminService;
@GetMapping("/udiwms/basic/unit/maintain/filter")
public BaseResponse filterBasicUnitMaintain(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest,
@ -45,10 +50,10 @@ public class BasicCorpController {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
List<BasicCorpEntity> basicUnitMaintainEntities;
List<BasicCorpResponse> basicUnitMaintainEntities;
basicUnitMaintainEntities = basicUnitMaintainService.filterList(basicUnitMaintainFilterRequest);
PageInfo<BasicCorpEntity> pageInfo = new PageInfo<>(basicUnitMaintainEntities);
PageSimpleResponse<BasicCorpEntity> pageSimpleResponse = new PageSimpleResponse<>();
PageInfo<BasicCorpResponse> pageInfo = new PageInfo<>(basicUnitMaintainEntities);
PageSimpleResponse<BasicCorpResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(basicUnitMaintainEntities);
@ -66,10 +71,10 @@ public class BasicCorpController {
if (basicUnitMaintainFilterRequest.getCompanyIdFk() == null)
return ResultVOUtils.error(500, "企业ID不能为空");
List<BasicCorpEntity> basicUnitMaintainEntities;
List<BasicCorpResponse> basicUnitMaintainEntities;
basicUnitMaintainEntities = basicUnitMaintainService.filterList(basicUnitMaintainFilterRequest);
PageInfo<BasicCorpEntity> pageInfo = new PageInfo<>(basicUnitMaintainEntities);
PageSimpleResponse<BasicCorpEntity> pageSimpleResponse = new PageSimpleResponse<>();
PageInfo<BasicCorpResponse> pageInfo = new PageInfo<>(basicUnitMaintainEntities);
PageSimpleResponse<BasicCorpResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(basicUnitMaintainEntities);
@ -161,4 +166,14 @@ public class BasicCorpController {
String companyId = request.getHeader("companyId");
return companyId;
}
public String getCustomerId() {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes == null) {
throw new JsonException(ResultEnum.NOT_NETWORK);
}
HttpServletRequest request = attributes.getRequest();
String userId = request.getHeader("ADMIN_ID");
AuthAdmin authAdmin = authAdminService.findById(Long.parseLong(userId));
return authAdmin.getCustomerId() + "";
}
}

@ -5,6 +5,7 @@ import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.basic.BasicCorpEntity;
import com.glxp.api.req.basic.BasicUnitMaintainFilterRequest;
import com.glxp.api.res.basic.BasicCorpResponse;
import com.glxp.api.res.thrsys.ThrUnitMaintainResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -13,7 +14,7 @@ import java.util.List;
@Mapper
public interface BasicCorpDao extends BaseMapperPlus<BasicCorpDao, BasicCorpEntity, BasicCorpEntity> {
List<BasicCorpEntity> filterList(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest);
List<BasicCorpResponse> filterList(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest);
boolean insertBasicUnitMaintain(BasicCorpEntity basicUnitMaintainEntity);

@ -48,5 +48,7 @@ public class BasicUnitMaintainFilterRequest extends ListPageRequest {
List<BasicErpUnitsResponse> thrCorpEntities;
@ApiModelProperty(value = "企业ID")
private Long companyIdFk;
@ApiModelProperty(value = "注册企业")
private String companyName;
}

@ -0,0 +1,10 @@
package com.glxp.api.res.basic;
import com.glxp.api.entity.basic.BasicCorpEntity;
import lombok.Data;
@Data
public class BasicCorpResponse extends BasicCorpEntity {
private String companyName;
}

@ -4,13 +4,14 @@ package com.glxp.api.service.basic;
import com.baomidou.mybatisplus.extension.service.IService;
import com.glxp.api.entity.basic.BasicCorpEntity;
import com.glxp.api.req.basic.BasicUnitMaintainFilterRequest;
import com.glxp.api.res.basic.BasicCorpResponse;
import java.util.List;
public interface BasicCorpService extends IService<BasicCorpEntity> {
List<BasicCorpEntity> filterList(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest);
List<BasicCorpResponse> filterList(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest);
boolean insertBasicUnitMaintain(BasicCorpEntity basicCorpEntity);

@ -6,6 +6,7 @@ import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.basic.BasicCorpDao;
import com.glxp.api.entity.basic.BasicCorpEntity;
import com.glxp.api.req.basic.BasicUnitMaintainFilterRequest;
import com.glxp.api.res.basic.BasicCorpResponse;
import com.glxp.api.res.thrsys.ThrUnitMaintainResponse;
import com.glxp.api.service.basic.BasicCorpService;
import org.springframework.stereotype.Service;
@ -25,7 +26,7 @@ public class BasicCorpServiceImpl extends ServiceImpl<BasicCorpDao, BasicCorpEnt
BasicCorpDao basicCorpDao;
@Override
public List<BasicCorpEntity> filterList(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest) {
public List<BasicCorpResponse> filterList(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest) {
if (basicUnitMaintainFilterRequest == null) {
return Collections.emptyList();
}
@ -34,7 +35,7 @@ public class BasicCorpServiceImpl extends ServiceImpl<BasicCorpDao, BasicCorpEnt
PageHelper.offsetPage(offset, basicUnitMaintainFilterRequest.getLimit());
}
List<BasicCorpEntity> data = basicCorpDao.filterList(basicUnitMaintainFilterRequest);
List<BasicCorpResponse> data = basicCorpDao.filterList(basicUnitMaintainFilterRequest);
return data;
}
@ -128,7 +129,7 @@ public class BasicCorpServiceImpl extends ServiceImpl<BasicCorpDao, BasicCorpEnt
}
BasicUnitMaintainFilterRequest filterUdiInfoRequest = new BasicUnitMaintainFilterRequest();
filterUdiInfoRequest.setErpId(id);
List<BasicCorpEntity> basicUnitMaintainEntities = basicCorpDao.filterList(filterUdiInfoRequest);
List<BasicCorpResponse> basicUnitMaintainEntities = basicCorpDao.filterList(filterUdiInfoRequest);
if (basicUnitMaintainEntities != null && basicUnitMaintainEntities.size() > 0)
return basicUnitMaintainEntities.get(0);
return null;
@ -144,7 +145,7 @@ public class BasicCorpServiceImpl extends ServiceImpl<BasicCorpDao, BasicCorpEnt
BasicUnitMaintainFilterRequest filterUdiInfoRequest = new BasicUnitMaintainFilterRequest();
filterUdiInfoRequest.setPage(1);
filterUdiInfoRequest.setLimit(1);
List<BasicCorpEntity> data = filterList(filterUdiInfoRequest);
List<BasicCorpResponse> data = filterList(filterUdiInfoRequest);
if (data != null && data.size() > 0) {
return true;
}

@ -110,6 +110,7 @@ public class uploadController {
if (StringUtils.isBlank(type)) {
return ResultVOUtils.error(ResultEnum.DATA_ERROR, "上传文件类型不能为空");
}
String fileName = file.getOriginalFilename();
String fileType = fileName.substring(fileName.lastIndexOf("."));
// 文件类型判断

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.glxp.api.dao.basic.BasicCorpDao">
<select id="filterList" parameterType="com.glxp.api.req.basic.BasicUnitMaintainFilterRequest"
<select id="filterList1" parameterType="com.glxp.api.req.basic.BasicUnitMaintainFilterRequest"
resultType="com.glxp.api.entity.basic.BasicCorpEntity">
SELECT *
FROM basic_corp
@ -48,6 +48,55 @@
order by updateTime desc
</select>
<select id="filterList" parameterType="com.glxp.api.req.basic.BasicUnitMaintainFilterRequest"
resultType="com.glxp.api.res.basic.BasicCorpResponse">
SELECT uc.companyName,bc.*
FROM basic_corp bc
LEFT JOIN user_company uc ON uc.id = bc.companyIdFk
<where>
<if test="key != '' and key != null">
and
(name like concat('%', #{key}, '%')
or spell like concat('%', #{key}, '%')
or erpId like concat('%', #{key}, '%')
or creditNo like concat('%', #{key}, '%')
or thirdId like concat('%', #{key}, '%')
or thirdId1 like concat('%', #{key}, '%')
or thirdId2 like concat('%', #{key}, '%')
or thirdId3 like concat('%', #{key}, '%')
or thirdId4 like concat('%', #{key}, '%')
or addr like concat('%', #{key}, '%')
)
</if>
<if test="companyName != null and companyName != ''">
AND companyName like concat('%', #{companyName}, '%')
</if>
<if test="name != null and name != ''">
AND name like concat('%', #{name}, '%')
</if>
<if test="id != '' and id != null">
AND id = #{id}
</if>
<if test="unitId != '' and unitId != null">
AND unitId = #{unitId}
</if>
<if test="erpId != '' and erpId != null">
AND erpId = #{erpId}
</if>
<if test="corpType != null">
AND corpType = #{corpType}
</if>
<if test="outType != null">
AND (outType <![CDATA[ <> ]]> #{outType} or outType is NULL)
</if>
<if test="lastUpdateTime != null and lastUpdateTime != ''">
<![CDATA[
and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S') >= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S')
]]>
</if>
</where>
</select>
<select id="selectByThirdId" parameterType="com.glxp.api.req.basic.BasicUnitMaintainFilterRequest"
resultType="com.glxp.api.entity.basic.BasicCorpEntity">
select *

Loading…
Cancel
Save