Merge remote-tracking branch 'origin/master'
						commit
						3811f4c659
					
				| @ -1,7 +1,82 @@ | |||||||
| package com.glxp.api.service.thrsys; | package com.glxp.api.service.thrsys; | ||||||
| 
 | 
 | ||||||
|  | import com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity; | ||||||
|  | import com.glxp.api.entity.thrsys.ThrSystemDetailEntity; | ||||||
|  | import com.glxp.api.req.thrsys.FilterThrBusTypeOriginRequest; | ||||||
|  | import com.glxp.api.res.thrsys.ThrBusTypeOriginResponse; | ||||||
|  | 
 | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
| /** | /** | ||||||
|  * 第三方单据类型Service |  * 第三方单据类型Service | ||||||
|  */ |  */ | ||||||
| public interface IThrBusTypeOriginService { | public interface IThrBusTypeOriginService { | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 查询启用的第三方单据类型列表 | ||||||
|  |      * | ||||||
|  |      * @param filterThrBusTypeOriginRequest | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     List<ThrBusTypeOriginEntity> filterEnableList(FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest); | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 关联查询第三方单据类型列表 | ||||||
|  |      * | ||||||
|  |      * @param filterThrBusTypeOriginRequest | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     List<ThrBusTypeOriginResponse> filterJoinList(FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest); | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 新增第三方单据类型 | ||||||
|  |      * | ||||||
|  |      * @param thrBusTypeOriginEntity | ||||||
|  |      */ | ||||||
|  |     boolean insertBusOriginType(ThrBusTypeOriginEntity thrBusTypeOriginEntity); | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 删除第三方单据类型 | ||||||
|  |      * | ||||||
|  |      * @param id | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     boolean deleteById(String id); | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 校验第三方单据类型是否存在 | ||||||
|  |      * | ||||||
|  |      * @param action | ||||||
|  |      * @param thirdSys | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     boolean checkActionExists(String action, String thirdSys); | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 更新第三方单据类型 | ||||||
|  |      * | ||||||
|  |      * @param thrBusTypeOriginEntity | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     boolean updateBusOriginType(ThrBusTypeOriginEntity thrBusTypeOriginEntity); | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 根据单据类型编码查询第三方单据类型 | ||||||
|  |      * | ||||||
|  |      * @param action | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     ThrBusTypeOriginEntity findByAction(String action); | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 根据单据类型编码查询第三方系统详情 | ||||||
|  |      * | ||||||
|  |      * @param action | ||||||
|  |      * @param key | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     ThrSystemDetailEntity findSysByAction(String action, String key); | ||||||
|  | 
 | ||||||
|  |     //ThrBusTypeOriginResponse findByThirdAction
 | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,12 +1,105 @@ | |||||||
| package com.glxp.api.service.thrsys.impl; | package com.glxp.api.service.thrsys.impl; | ||||||
| 
 | 
 | ||||||
|  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||||
|  | import com.github.pagehelper.PageHelper; | ||||||
|  | import com.glxp.api.dao.thrsys.ThrBusTypeOriginDao; | ||||||
|  | import com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity; | ||||||
|  | import com.glxp.api.entity.thrsys.ThrSystemDetailEntity; | ||||||
|  | import com.glxp.api.req.thrsys.FilterThrBusTypeOriginRequest; | ||||||
|  | import com.glxp.api.res.thrsys.ThrBusTypeOriginResponse; | ||||||
|  | import com.glxp.api.service.auth.CustomerService; | ||||||
| import com.glxp.api.service.thrsys.IThrBusTypeOriginService; | import com.glxp.api.service.thrsys.IThrBusTypeOriginService; | ||||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||||
| 
 | 
 | ||||||
|  | import javax.annotation.Resource; | ||||||
|  | import java.util.Collections; | ||||||
|  | import java.util.Date; | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
| @Slf4j | @Slf4j | ||||||
| @Service | @Service | ||||||
| @Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||||
| public class ThrBusTypeOriginServiceImpl implements IThrBusTypeOriginService { | public class ThrBusTypeOriginServiceImpl implements IThrBusTypeOriginService { | ||||||
|  | 
 | ||||||
|  |     @Resource | ||||||
|  |     private CustomerService customerService; | ||||||
|  |     @Resource | ||||||
|  |     private ThrBusTypeOriginDao thrBusTypeOriginDao; | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public List<ThrBusTypeOriginEntity> filterEnableList(FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest) { | ||||||
|  |         if (null != filterThrBusTypeOriginRequest.getPage() && null != filterThrBusTypeOriginRequest.getLimit()) { | ||||||
|  |             PageHelper.offsetPage((filterThrBusTypeOriginRequest.getPage() - 1) * filterThrBusTypeOriginRequest.getLimit(), filterThrBusTypeOriginRequest.getLimit()); | ||||||
|  |         } | ||||||
|  |         return thrBusTypeOriginDao.filterEnableList(filterThrBusTypeOriginRequest); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public List<ThrBusTypeOriginResponse> filterJoinList(FilterThrBusTypeOriginRequest filterThrBusTypeOriginRequest) { | ||||||
|  |         if (null == filterThrBusTypeOriginRequest) { | ||||||
|  |             return Collections.emptyList(); | ||||||
|  |         } | ||||||
|  |         if (null != filterThrBusTypeOriginRequest.getPage() && null != filterThrBusTypeOriginRequest.getLimit()) { | ||||||
|  |             PageHelper.offsetPage((filterThrBusTypeOriginRequest.getPage() - 1) * filterThrBusTypeOriginRequest.getLimit(), filterThrBusTypeOriginRequest.getLimit()); | ||||||
|  |         } | ||||||
|  |         return thrBusTypeOriginDao.filterJoinList(filterThrBusTypeOriginRequest); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public boolean insertBusOriginType(ThrBusTypeOriginEntity thrBusTypeOriginEntity) { | ||||||
|  |         //设置创建信息
 | ||||||
|  |         setUpdateInfo(thrBusTypeOriginEntity); | ||||||
|  |         return thrBusTypeOriginDao.insertBusOriginType(thrBusTypeOriginEntity); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public boolean deleteById(String id) { | ||||||
|  |         return thrBusTypeOriginDao.deleteById(id) != 0; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public boolean checkActionExists(String action, String thirdSys) { | ||||||
|  |         Long count = thrBusTypeOriginDao.selectCount(new QueryWrapper<ThrBusTypeOriginEntity>().eq("action", action).eq("thirdSys", thirdSys)); | ||||||
|  |         if (count > 0) { | ||||||
|  |             return true; | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public boolean updateBusOriginType(ThrBusTypeOriginEntity thrBusTypeOriginEntity) { | ||||||
|  |         //设置更新信息
 | ||||||
|  |         setUpdateInfo(thrBusTypeOriginEntity); | ||||||
|  |         thrBusTypeOriginEntity.setEnable(true); | ||||||
|  |         return thrBusTypeOriginDao.updateById(thrBusTypeOriginEntity) != 0; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public ThrBusTypeOriginEntity findByAction(String action) { | ||||||
|  |         return null; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public ThrSystemDetailEntity findSysByAction(String action, String key) { | ||||||
|  |         return null; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 设置创建/更新信息 | ||||||
|  |      * | ||||||
|  |      * @param thrBusTypeOriginEntity | ||||||
|  |      */ | ||||||
|  |     private void setUpdateInfo(ThrBusTypeOriginEntity thrBusTypeOriginEntity) { | ||||||
|  |         Date now = new Date(); | ||||||
|  |         String userId = String.valueOf(customerService.getUserId()); | ||||||
|  |         if (null == thrBusTypeOriginEntity.getId()) { | ||||||
|  |             thrBusTypeOriginEntity.setCreateUser(userId); | ||||||
|  |             thrBusTypeOriginEntity.setCreateTime(now); | ||||||
|  |         } | ||||||
|  |         thrBusTypeOriginEntity.setUpdateUser(userId); | ||||||
|  |         thrBusTypeOriginEntity.setUpdateTime(now); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,5 +1,77 @@ | |||||||
| <?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.thrsys.ThrBusTypeOriginDao"> | <mapper namespace="com.glxp.api.dao.thrsys.ThrBusTypeOriginDao"> | ||||||
|  |     <select id="filterEnableList" resultType="com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity"> | ||||||
|  |         select * | ||||||
|  |         from thr_bustype_origin tbo | ||||||
|  |                  left join thr_system_detail | ||||||
|  |                            on tbo.thirdSys = thr_system_detail.thirdSysFk | ||||||
|  |         <where> | ||||||
|  |             thr_system_detail.`key` = 'busTypeQueryUrl' | ||||||
|  |               and thr_system_detail.enabled = 1 | ||||||
|  |             <if test="name != null and name != ''"> | ||||||
|  |                 AND tbo.name like concat('%', #{name}, '%') | ||||||
|  |             </if> | ||||||
|  |             <if test="action != null and action != ''"> | ||||||
|  |                 AND tbo.action like concat('%', #{action}, '%') | ||||||
|  |             </if> | ||||||
|  |             <if test="key != null and key != ''"> | ||||||
|  |                 AND ((tbo.name LIKE concat('%', #{key}, '%')) or (tbo.action LIKE | ||||||
|  |                                                                   concat('%', #{key}, '%'))) | ||||||
|  |             </if> | ||||||
|  |             <if test="thirdSys != null and thirdSys != ''"> | ||||||
|  |                 AND tbo.thirdSys = #{thirdSys} | ||||||
|  |             </if> | ||||||
|  |         </where> | ||||||
|  |     </select> | ||||||
| 
 | 
 | ||||||
|  |     <select id="filterJoinList" resultType="com.glxp.api.res.thrsys.ThrBusTypeOriginResponse"> | ||||||
|  |         select tbo.name, | ||||||
|  |                tbo.action thirdAction, | ||||||
|  |                tbo.name   thirdName, | ||||||
|  |                bu.action, | ||||||
|  |                bu.mainAction, | ||||||
|  |                tbo.thirdSys, | ||||||
|  |                bu.corpType | ||||||
|  |         from thr_bustype_origin tbo | ||||||
|  |                  left join basic_bussiness_type bu on tbo.action = bu.originAction | ||||||
|  |         <where> | ||||||
|  |             <if test="name != null and name != ''"> | ||||||
|  |                 AND tbo.name like concat('%', #{name}, '%') | ||||||
|  |             </if> | ||||||
|  |             <if test="thirdAction != ''and thirdAction != null"> | ||||||
|  |                 AND tbo.action = #{thirdAction} | ||||||
|  |             </if> | ||||||
|  |             <if test="mainAction != ''and mainAction != null"> | ||||||
|  |                 AND tbo.action = #{mainAction} | ||||||
|  |             </if> | ||||||
|  |             <if test="busAction != ''and busAction != null"> | ||||||
|  |                 AND bu.action = #{busAction} | ||||||
|  |             </if> | ||||||
|  |             <if test="action != ''and action != null"> | ||||||
|  |                 AND tbo.action = #{thirdAction} | ||||||
|  |             </if> | ||||||
|  |             <if test="corpType != ''and corpType != null"> | ||||||
|  |                 AND bu.corpType = #{corpType} | ||||||
|  |             </if> | ||||||
|  |         </where> | ||||||
|  |         group by tbo.action | ||||||
|  |     </select> | ||||||
|  | 
 | ||||||
|  |     <insert id="insertBusOriginType" parameterType="com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity"> | ||||||
|  |         replace into thr_bustype_origin | ||||||
|  |         (`name`, `action`, thirdSys, thirdSysName, `enable`, inoutType, updateTime, remark, createUser, updateUser, | ||||||
|  |          createTime) | ||||||
|  |         values (#{name}, | ||||||
|  |                 #{action}, | ||||||
|  |                 #{thirdSys}, | ||||||
|  |                 #{thirdSysName}, | ||||||
|  |                 #{enable}, | ||||||
|  |                 #{inoutType}, | ||||||
|  |                 #{updateTime}, | ||||||
|  |                 #{remark}, | ||||||
|  |                 #{createUser}, | ||||||
|  |                 #{updateUser}, | ||||||
|  |                 #{createTime}) | ||||||
|  |     </insert> | ||||||
| </mapper> | </mapper> | ||||||
					Loading…
					
					
				
		Reference in New Issue