新增生产企业字典维护
							parent
							
								
									1ed3360997
								
							
						
					
					
						commit
						805c82e972
					
				| @ -1,9 +1,30 @@ | |||||||
| package com.glxp.api.dao.basic; | package com.glxp.api.dao.basic; | ||||||
| 
 | 
 | ||||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 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.entity.basic.BasicManufacturerEntity; | ||||||
|  | import com.glxp.api.req.basic.BasicUnitMaintainFilterRequest; | ||||||
| import org.apache.ibatis.annotations.Mapper; | import org.apache.ibatis.annotations.Mapper; | ||||||
|  | import org.apache.ibatis.annotations.Param; | ||||||
|  | 
 | ||||||
|  | import java.util.List; | ||||||
| 
 | 
 | ||||||
| @Mapper | @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; | 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 org.springframework.stereotype.Service; | ||||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||||
| import com.glxp.api.entity.basic.BasicManufacturerEntity; | import com.glxp.api.entity.basic.BasicManufacturerEntity; | ||||||
| import com.glxp.api.dao.basic.BasicManufacturerMapper; | import com.glxp.api.dao.basic.BasicManufacturerMapper; | ||||||
|  | 
 | ||||||
|  | import javax.annotation.Resource; | ||||||
|  | import java.util.*; | ||||||
|  | 
 | ||||||
| @Service | @Service | ||||||
| public class BasicManufacturerService extends ServiceImpl<BasicManufacturerMapper, BasicManufacturerEntity> { | 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"?> | <?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"> | <!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"> | <mapper namespace="com.glxp.api.dao.basic.BasicManufacturerMapper"> | ||||||
|   <resultMap id="BaseResultMap" type="com.glxp.api.entity.basic.BasicManufacturerEntity"> |     <select id="filterList" parameterType="com.glxp.api.req.basic.BasicUnitMaintainFilterRequest" | ||||||
|     <!--@mbg.generated--> |             resultType="com.glxp.api.entity.basic.BasicManufacturerEntity"> | ||||||
|     <!--@Table basic_manufacturer--> |         SELECT * | ||||||
|     <id column="id" jdbcType="BIGINT" property="id" /> |         FROM basic_manufacturer | ||||||
|     <result column="code" jdbcType="VARCHAR" property="code" /> |         <where> | ||||||
|     <result column="name" jdbcType="VARCHAR" property="name" /> |             <if test="key != '' and key != null"> | ||||||
|     <result column="spell" jdbcType="VARCHAR" property="spell" /> |                 and | ||||||
|     <result column="addr" jdbcType="VARCHAR" property="addr" /> |                 (name like concat('%', #{key}, '%') | ||||||
|     <result column="status" jdbcType="VARCHAR" property="status" /> |                         or spell like concat('%', #{key}, '%') | ||||||
|     <result column="type" jdbcType="VARCHAR" property="type" /> |                         or erpId like concat('%', #{key}, '%') | ||||||
|     <result column="contact" jdbcType="VARCHAR" property="contact" /> |                         or creditNo like concat('%', #{key}, '%') | ||||||
|     <result column="mobile" jdbcType="VARCHAR" property="mobile" /> |                         or thirdId like concat('%', #{key}, '%') | ||||||
|     <result column="creditCode" jdbcType="VARCHAR" property="creditCode" /> |                         or thirdId1 like concat('%', #{key}, '%') | ||||||
|     <result column="remark" jdbcType="VARCHAR" property="remark" /> |                         or thirdId2 like concat('%', #{key}, '%') | ||||||
|     <result column="thirdId" jdbcType="VARCHAR" property="thirdId" /> |                         or thirdId3 like concat('%', #{key}, '%') | ||||||
|     <result column="thirdId1" jdbcType="VARCHAR" property="thirdId1" /> |                         or thirdId4 like concat('%', #{key}, '%') | ||||||
|     <result column="thirdId2" jdbcType="VARCHAR" property="thirdId2" /> |                         or addr like concat('%', #{key}, '%') | ||||||
|     <result column="thirdId3" jdbcType="VARCHAR" property="thirdId3" /> |                         ) | ||||||
|     <result column="thirdId4" jdbcType="VARCHAR" property="thirdId4" /> |             </if> | ||||||
|     <result column="createUser" jdbcType="VARCHAR" property="createUser" /> |             <if test="id != '' and id != null"> | ||||||
|     <result column="createTime" jdbcType="TIMESTAMP" property="createTime" /> |                 AND id = #{id} | ||||||
|     <result column="updateUser" jdbcType="VARCHAR" property="updateUser" /> |             </if> | ||||||
|     <result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" /> |             <if test="erpId != '' and erpId != null"> | ||||||
|   </resultMap> |                 AND erpId = #{erpId} | ||||||
|   <sql id="Base_Column_List"> |             </if> | ||||||
|     <!--@mbg.generated--> |             <if test="lastUpdateTime != null and lastUpdateTime != ''"> | ||||||
|     id, code, `name`, spell, addr, `status`, `type`, contact, mobile, creditCode, remark, |                 <![CDATA[ | ||||||
|     thirdId, thirdId1, thirdId2, thirdId3, thirdId4, `createUser`, createTime, updateUser, |                 and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S') >= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S') | ||||||
|     updateTime |                 ]]> | ||||||
|   </sql> |             </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> | </mapper> | ||||||
|  | |||||||
					Loading…
					
					
				
		Reference in New Issue