新增生产企业字典维护
							parent
							
								
									1ed3360997
								
							
						
					
					
						commit
						805c82e972
					
				| @ -1,9 +1,30 @@ | ||||
| package com.glxp.api.dao.basic; | ||||
| 
 | ||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||||
| import com.glxp.api.dao.BaseMapperPlus; | ||||
| import com.glxp.api.entity.basic.BasicCorpEntity; | ||||
| import com.glxp.api.entity.basic.BasicManufacturerEntity; | ||||
| import com.glxp.api.req.basic.BasicUnitMaintainFilterRequest; | ||||
| import org.apache.ibatis.annotations.Mapper; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| @Mapper | ||||
| public interface BasicManufacturerMapper extends BaseMapper<BasicManufacturerEntity> { | ||||
| public interface BasicManufacturerMapper extends BaseMapperPlus<BasicManufacturerMapper, BasicManufacturerEntity, BasicManufacturerEntity> { | ||||
| 
 | ||||
|     List<BasicManufacturerEntity> filterList(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest); | ||||
| 
 | ||||
| 
 | ||||
|     List<BasicManufacturerEntity> batchSelectByErpIdsAndName(@Param("erpIds") List<String> erpIds, @Param("name") String name); | ||||
| 
 | ||||
|     /** | ||||
|      * 根据往来单位名称和社会信用号查询列表 | ||||
|      * | ||||
|      * @param name | ||||
|      * @param creditNo | ||||
|      * @return | ||||
|      */ | ||||
|     List<BasicManufacturerEntity> selectByNameAndCreditNo(@Param("name") String name, @Param("creditNo") String creditNo); | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -1,10 +1,118 @@ | ||||
| package com.glxp.api.service.basic; | ||||
| 
 | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.util.IdUtil; | ||||
| import cn.hutool.extra.pinyin.PinyinUtil; | ||||
| import com.github.pagehelper.PageHelper; | ||||
| import com.glxp.api.common.res.BaseResponse; | ||||
| import com.glxp.api.constant.ConstantStatus; | ||||
| import com.glxp.api.entity.basic.BasicCorpEntity; | ||||
| import com.glxp.api.entity.thrsys.ThrManufacturerEntity; | ||||
| import com.glxp.api.entity.thrsys.ThrSystemDetailEntity; | ||||
| import com.glxp.api.req.basic.BasicUnitMaintainFilterRequest; | ||||
| import com.glxp.api.req.thrsys.FilterThrCorpRequest; | ||||
| import com.glxp.api.req.thrsys.ThrUnitMaintainFilterRequest; | ||||
| import com.glxp.api.res.PageSimpleResponse; | ||||
| import com.glxp.api.res.thrsys.ThrCorpsResponse; | ||||
| import com.glxp.api.service.thrsys.ThrManufacturerService; | ||||
| import com.glxp.api.util.CustomUtil; | ||||
| import org.springframework.beans.BeanUtils; | ||||
| import org.springframework.scheduling.annotation.Async; | ||||
| import org.springframework.stereotype.Service; | ||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||
| import com.glxp.api.entity.basic.BasicManufacturerEntity; | ||||
| import com.glxp.api.dao.basic.BasicManufacturerMapper; | ||||
| 
 | ||||
| import javax.annotation.Resource; | ||||
| import java.util.*; | ||||
| 
 | ||||
| @Service | ||||
| public class BasicManufacturerService extends ServiceImpl<BasicManufacturerMapper, BasicManufacturerEntity> { | ||||
| 
 | ||||
| 
 | ||||
|     @Resource | ||||
|     BasicManufacturerMapper basicManufacturerMapper; | ||||
| 
 | ||||
|     public List<BasicManufacturerEntity> filterList(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest) { | ||||
|         if (basicUnitMaintainFilterRequest == null) { | ||||
|             return Collections.emptyList(); | ||||
|         } | ||||
|         if (basicUnitMaintainFilterRequest.getPage() != null) { | ||||
|             int offset = (basicUnitMaintainFilterRequest.getPage() - 1) * basicUnitMaintainFilterRequest.getLimit(); | ||||
|             PageHelper.offsetPage(offset, basicUnitMaintainFilterRequest.getLimit()); | ||||
|         } | ||||
| 
 | ||||
|         List<BasicManufacturerEntity> data = basicManufacturerMapper.filterList(basicUnitMaintainFilterRequest); | ||||
|         return data; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     public boolean verifyExists(BasicManufacturerEntity basicCorpEntity) { | ||||
|         List<BasicManufacturerEntity> list = basicManufacturerMapper.selectByNameAndCreditNo(basicCorpEntity.getName(), basicCorpEntity.getCreditNo()); | ||||
|         if (CollUtil.isNotEmpty(list)) { | ||||
|             if (null != basicCorpEntity.getId()) { | ||||
|                 for (BasicManufacturerEntity corpEntity : list) { | ||||
|                     if (!corpEntity.getId().equals(basicCorpEntity.getId())) { | ||||
|                         return true; | ||||
|                     } | ||||
|                 } | ||||
|             } else { | ||||
|                 return true; | ||||
|             } | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
| 
 | ||||
|     @Resource | ||||
|     ThrManufacturerService thrManufacturerService; | ||||
| 
 | ||||
|     @Async | ||||
|     public void selectAllUnit(ThrSystemDetailEntity thrSystemDetailEntity, ThrUnitMaintainFilterRequest unitMaintainFilterRequest) { | ||||
|         List<ThrManufacturerEntity> imports = new ArrayList<>(); | ||||
| 
 | ||||
|         FilterThrCorpRequest filterThrCorpRequest = new FilterThrCorpRequest(); | ||||
|         BeanUtils.copyProperties(unitMaintainFilterRequest, filterThrCorpRequest); | ||||
|         filterThrCorpRequest.setThirdSysFk(unitMaintainFilterRequest.getThirdSys()); | ||||
|         filterThrCorpRequest.setPage(null); | ||||
|         List<ThrManufacturerEntity> thrCorpEntities = thrManufacturerService.filterThrManu(filterThrCorpRequest); | ||||
|         imports.addAll(thrCorpEntities); | ||||
|         if (imports != null && imports.size() > 0) { | ||||
|             for (ThrManufacturerEntity erpUnitsResponse : imports) { | ||||
|                 BasicManufacturerEntity thrUnitMaintainResponse = new BasicManufacturerEntity(); | ||||
|                 if (unitMaintainFilterRequest.getThirdSys() != null) { | ||||
|                     if ("thirdId".equals(unitMaintainFilterRequest.getThirdSys())) { | ||||
|                         thrUnitMaintainResponse.setThirdId(erpUnitsResponse.getUnitId()); | ||||
|                         thrUnitMaintainResponse.setThirdName(erpUnitsResponse.getName()); | ||||
|                     } else if ("thirdId1".equals(unitMaintainFilterRequest.getThirdSys())) { | ||||
|                         thrUnitMaintainResponse.setThirdId1(erpUnitsResponse.getUnitId()); | ||||
|                         thrUnitMaintainResponse.setThirdName1(erpUnitsResponse.getName()); | ||||
|                     } else if ("thirdId2".equals(unitMaintainFilterRequest.getThirdSys())) { | ||||
|                         thrUnitMaintainResponse.setThirdId2(erpUnitsResponse.getUnitId()); | ||||
|                         thrUnitMaintainResponse.setThirdName2(erpUnitsResponse.getName()); | ||||
|                     } else if ("thirdId3".equals(unitMaintainFilterRequest.getThirdSys())) { | ||||
|                         thrUnitMaintainResponse.setThirdId3(erpUnitsResponse.getUnitId()); | ||||
|                         thrUnitMaintainResponse.setThirdName3(erpUnitsResponse.getName()); | ||||
|                     } else if ("thirdId4".equals(unitMaintainFilterRequest.getThirdSys())) { | ||||
|                         thrUnitMaintainResponse.setThirdId4(erpUnitsResponse.getUnitId()); | ||||
|                         thrUnitMaintainResponse.setThirdName4(erpUnitsResponse.getName()); | ||||
|                     } | ||||
|                 } | ||||
|                 thrUnitMaintainResponse.setErpId(CustomUtil.getId()); | ||||
|                 thrUnitMaintainResponse.setName(erpUnitsResponse.getName()); | ||||
|                 if (erpUnitsResponse.getSpell() == null || "".equals(erpUnitsResponse.getSpell())) { | ||||
|                     thrUnitMaintainResponse.setSpell(PinyinUtil.getFirstLetter(erpUnitsResponse.getName(), "").toUpperCase(Locale.ROOT)); | ||||
|                 } else { | ||||
|                     thrUnitMaintainResponse.setSpell(erpUnitsResponse.getSpell()); | ||||
|                 } | ||||
|                 thrUnitMaintainResponse.setAddr(erpUnitsResponse.getAddr()); | ||||
|                 thrUnitMaintainResponse.setCreditNo(erpUnitsResponse.getCreditNo()); | ||||
|                 thrUnitMaintainResponse.setCorpType(ConstantStatus.CORP_SP); | ||||
|                 thrUnitMaintainResponse.setContact(erpUnitsResponse.getContact()); | ||||
|                 thrUnitMaintainResponse.setMobile(erpUnitsResponse.getMobile()); | ||||
|                 thrUnitMaintainResponse.setUpdateTime(new Date()); | ||||
|                 thrUnitMaintainResponse.setId(IdUtil.getSnowflakeNextId()); | ||||
|                 basicManufacturerMapper.insertIgnore(thrUnitMaintainResponse); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -1,34 +1,67 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!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.BasicManufacturerMapper"> | ||||
|   <resultMap id="BaseResultMap" type="com.glxp.api.entity.basic.BasicManufacturerEntity"> | ||||
|     <!--@mbg.generated--> | ||||
|     <!--@Table basic_manufacturer--> | ||||
|     <id column="id" jdbcType="BIGINT" property="id" /> | ||||
|     <result column="code" jdbcType="VARCHAR" property="code" /> | ||||
|     <result column="name" jdbcType="VARCHAR" property="name" /> | ||||
|     <result column="spell" jdbcType="VARCHAR" property="spell" /> | ||||
|     <result column="addr" jdbcType="VARCHAR" property="addr" /> | ||||
|     <result column="status" jdbcType="VARCHAR" property="status" /> | ||||
|     <result column="type" jdbcType="VARCHAR" property="type" /> | ||||
|     <result column="contact" jdbcType="VARCHAR" property="contact" /> | ||||
|     <result column="mobile" jdbcType="VARCHAR" property="mobile" /> | ||||
|     <result column="creditCode" jdbcType="VARCHAR" property="creditCode" /> | ||||
|     <result column="remark" jdbcType="VARCHAR" property="remark" /> | ||||
|     <result column="thirdId" jdbcType="VARCHAR" property="thirdId" /> | ||||
|     <result column="thirdId1" jdbcType="VARCHAR" property="thirdId1" /> | ||||
|     <result column="thirdId2" jdbcType="VARCHAR" property="thirdId2" /> | ||||
|     <result column="thirdId3" jdbcType="VARCHAR" property="thirdId3" /> | ||||
|     <result column="thirdId4" jdbcType="VARCHAR" property="thirdId4" /> | ||||
|     <result column="createUser" jdbcType="VARCHAR" property="createUser" /> | ||||
|     <result column="createTime" jdbcType="TIMESTAMP" property="createTime" /> | ||||
|     <result column="updateUser" jdbcType="VARCHAR" property="updateUser" /> | ||||
|     <result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" /> | ||||
|   </resultMap> | ||||
|   <sql id="Base_Column_List"> | ||||
|     <!--@mbg.generated--> | ||||
|     id, code, `name`, spell, addr, `status`, `type`, contact, mobile, creditCode, remark, | ||||
|     thirdId, thirdId1, thirdId2, thirdId3, thirdId4, `createUser`, createTime, updateUser, | ||||
|     updateTime | ||||
|   </sql> | ||||
|     <select id="filterList" parameterType="com.glxp.api.req.basic.BasicUnitMaintainFilterRequest" | ||||
|             resultType="com.glxp.api.entity.basic.BasicManufacturerEntity"> | ||||
|         SELECT * | ||||
|         FROM basic_manufacturer | ||||
|         <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="id != '' and id != null"> | ||||
|                 AND id = #{id} | ||||
|             </if> | ||||
|             <if test="erpId != '' and erpId != null"> | ||||
|                 AND erpId = #{erpId} | ||||
|             </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> | ||||
|         order by updateTime desc | ||||
|     </select> | ||||
| 
 | ||||
| 
 | ||||
|     <select id="batchSelectByErpIdsAndName" resultType="com.glxp.api.entity.basic.BasicManufacturerEntity"> | ||||
|         select * | ||||
|         from basic_manufacturer | ||||
|         <where> | ||||
|             <if test="name != null and name != ''"> | ||||
|                 AND name like concat('%', #{name}, '%') | ||||
|             </if> | ||||
|             <if test="erpIds != null and erpIds.size() != 0"> | ||||
|                 AND erpId in | ||||
|                 <foreach collection="erpIds" item="item" index="index" separator="," open="(" close=")"> | ||||
|                     #{item} | ||||
|                 </foreach> | ||||
|             </if> | ||||
|         </where> | ||||
|     </select> | ||||
| 
 | ||||
|     <select id="selectByNameAndCreditNo" resultType="com.glxp.api.entity.basic.BasicManufacturerEntity"> | ||||
|         select * | ||||
|         from basic_manufacturer | ||||
|         <where> | ||||
|             <if test="name != null and name != ''"> | ||||
|                 AND name = #{name} | ||||
|             </if> | ||||
|             <if test="creditNo != null and creditNo != ''"> | ||||
|                 AND creditNo = #{creditNo} | ||||
|             </if> | ||||
|         </where> | ||||
|     </select> | ||||
| </mapper> | ||||
|  | ||||
					Loading…
					
					
				
		Reference in New Issue