Showing
7 changed files
with
112 additions
and
16 deletions
| ... | @@ -194,7 +194,7 @@ public class BasfDataInterface { | ... | @@ -194,7 +194,7 @@ public class BasfDataInterface { |
| 194 | //记录请求的运单 | 194 | //记录请求的运单 |
| 195 | IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLogCselect(consignmentCode.getConsignmentCode(),appId,appKey,new Date(Long.valueOf(timeStamp)))); | 195 | IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLogCselect(consignmentCode.getConsignmentCode(),appId,appKey,new Date(Long.valueOf(timeStamp)))); |
| 196 | //查询请求需要得运单申报信息 | 196 | //查询请求需要得运单申报信息 |
| 197 | - List<DeclaredInfo> declaredInfos = declaredInfoService.selectDeclaredInfo(splitConsignment); | 197 | + List<DeclaredInfo> declaredInfos = declaredInfoService.selectDeclaredInfo(splitConsignment,appId); |
| 198 | //构造返回数据 | 198 | //构造返回数据 |
| 199 | List<BasfConsignment> basfConsignments = basfConsignmentService.basfConsignmentList(declaredInfos); | 199 | List<BasfConsignment> basfConsignments = basfConsignmentService.basfConsignmentList(declaredInfos); |
| 200 | //返回申报数据 | 200 | //返回申报数据 |
| ... | @@ -254,7 +254,7 @@ public class BasfDataInterface { | ... | @@ -254,7 +254,7 @@ public class BasfDataInterface { |
| 254 | IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLogCselect(consignmentCode.getConsignmentCode(),appId,appKey,new Date(Long.valueOf(timeStamp)))); | 254 | IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLogCselect(consignmentCode.getConsignmentCode(),appId,appKey,new Date(Long.valueOf(timeStamp)))); |
| 255 | //查询请求需要得运单申报信息 | 255 | //查询请求需要得运单申报信息 |
| 256 | //List<DeclaredInfo> declaredInfos = declaredInfoService.selectDeclaredInfo(splitConsignment); | 256 | //List<DeclaredInfo> declaredInfos = declaredInfoService.selectDeclaredInfo(splitConsignment); |
| 257 | - List<BasfcReceipt> chmConsignments = chmConsignmentService.getConsignmentCode(splitConsignment); | 257 | + List<BasfcReceipt> chmConsignments = chmConsignmentService.getConsignmentCode(splitConsignment,appId); |
| 258 | //构造返回数据 | 258 | //构造返回数据 |
| 259 | //List<BasfConsignment> basfConsignments = basfConsignmentService.basfConsignmentList(declaredInfos); | 259 | //List<BasfConsignment> basfConsignments = basfConsignmentService.basfConsignmentList(declaredInfos); |
| 260 | //返回申报数据 | 260 | //返回申报数据 | ... | ... |
| ... | @@ -330,6 +330,13 @@ public class ChmConsignment implements Serializable { | ... | @@ -330,6 +330,13 @@ public class ChmConsignment implements Serializable { |
| 330 | @Column(name = "CREATE_TIME") | 330 | @Column(name = "CREATE_TIME") |
| 331 | private Date createTime; | 331 | private Date createTime; |
| 332 | 332 | ||
| 333 | + /** | ||
| 334 | + * 运单创建人ID | ||
| 335 | + */ | ||
| 336 | + @JsonIgnore | ||
| 337 | + @ManyToOne(targetEntity = SysUser.class) | ||
| 338 | + @JoinColumn(name = "CREATOR_ID") | ||
| 339 | + private SysUser creatorId; | ||
| 333 | 340 | ||
| 334 | /** | 341 | /** |
| 335 | * 运单创建人 | 342 | * 运单创建人 | ... | ... |
| ... | @@ -45,6 +45,6 @@ public interface ChmConsignmentRepository extends JpaSpecificationExecutor<ChmCo | ... | @@ -45,6 +45,6 @@ public interface ChmConsignmentRepository extends JpaSpecificationExecutor<ChmCo |
| 45 | */ | 45 | */ |
| 46 | @Query( nativeQuery = true,value = "select ID,CONSIGNMENT_CODE,CUSTOMS_RECEIPT,CONS_TYPE,CUSTOMS_RECEIPT_TIME from T_CHM_CONSIGNMENT where ID IN(\n" + | 46 | @Query( nativeQuery = true,value = "select ID,CONSIGNMENT_CODE,CUSTOMS_RECEIPT,CONS_TYPE,CUSTOMS_RECEIPT_TIME from T_CHM_CONSIGNMENT where ID IN(\n" + |
| 47 | "select MAX(ID)as ID from T_CHM_CONSIGNMENT \n" + | 47 | "select MAX(ID)as ID from T_CHM_CONSIGNMENT \n" + |
| 48 | - "where CONS_TYPE_ID = ?2 and CUSTOMS_RECEIPT is not null AND CONSIGNMENT_CODE IN ?1 GROUP BY CONSIGNMENT_CODE)") | 48 | + "where CREATOR_ID = ?3 AND CONS_TYPE_ID = ?2 and CUSTOMS_RECEIPT is not null AND CONSIGNMENT_CODE IN ?1 GROUP BY CONSIGNMENT_CODE)") |
| 49 | - public List<Object[]> findChmByConsignmentCode(List<String> consignmentCode, Long consTypeId); | 49 | + public List<Object[]> findChmByConsignmentCode(List<String> consignmentCode, Long consTypeId,Long creatorId); |
| 50 | } | 50 | } | ... | ... |
| ... | @@ -20,6 +20,6 @@ public interface DeclaredInfoRepository extends JpaRepository<DeclaredInfo, Inte | ... | @@ -20,6 +20,6 @@ public interface DeclaredInfoRepository extends JpaRepository<DeclaredInfo, Inte |
| 20 | * 根据运单号在申报数据表中查询数据 | 20 | * 根据运单号在申报数据表中查询数据 |
| 21 | * @return | 21 | * @return |
| 22 | */ | 22 | */ |
| 23 | - @Query(nativeQuery = true, value = "select * from T_DECLARED_INFO where CONSIGNMENT_ID IN (SELECT MAX(ID)AS ID FROM T_CHM_CONSIGNMENT WHERE T_CHM_CONSIGNMENT.CONS_TYPE_ID = ?2 and CONSIGNMENT_CODE IN ?1 group by CONSIGNMENT_CODE)") | 23 | + @Query(nativeQuery = true, value = "select * from T_DECLARED_INFO where CONSIGNMENT_ID IN (SELECT MAX(ID)AS ID FROM T_CHM_CONSIGNMENT t WHERE t.CREATOR_ID = ?3 and t.CONS_TYPE_ID = ?2 and CONSIGNMENT_CODE IN ?1 group by CONSIGNMENT_CODE)") |
| 24 | - public List<DeclaredInfo> getDeclaredInfoByAll(List<String> consignmentCodeList,Long consTypeId); | 24 | + public List<DeclaredInfo> getDeclaredInfoByAll(List<String> consignmentCodeList,Long consTypeId,Long creator); |
| 25 | } | 25 | } | ... | ... |
| 1 | +package com.erry.iclear.dateInterface.repository; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.entity.SysUser; | ||
| 4 | +import org.springframework.data.jpa.repository.JpaRepository; | ||
| 5 | +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 6 | +import org.springframework.data.jpa.repository.Query; | ||
| 7 | +import org.springframework.stereotype.Repository; | ||
| 8 | + | ||
| 9 | +import java.math.BigDecimal; | ||
| 10 | +import java.util.List; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * Created by liyang on 2017/2/21. | ||
| 14 | + */ | ||
| 15 | +@Repository | ||
| 16 | +public interface SysUserRepository extends JpaSpecificationExecutor<SysUser>, JpaRepository<SysUser, Long> { | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + | ||
| 21 | + @Query(nativeQuery = true, value = "select * from t_au_user where login_name = ?1") | ||
| 22 | + public List<SysUser> findByLoginName(String loginName); | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 根据用户登录名list查询用户列表信息 | ||
| 26 | + * | ||
| 27 | + * @param loginNames | ||
| 28 | + * @return | ||
| 29 | + */ | ||
| 30 | + @Query(nativeQuery = true, value = "select * from t_au_user where login_name IN (?1) ") | ||
| 31 | + public List<SysUser> findUserListByLoginNames(List loginNames); | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 根据登录名查询单个用户信息 | ||
| 35 | + * | ||
| 36 | + * @param loginName | ||
| 37 | + * @return | ||
| 38 | + */ | ||
| 39 | + @Query(nativeQuery = true, value = "select * from t_au_user where login_name = ?1") | ||
| 40 | + public SysUser findUserByLoginName(String loginName); | ||
| 41 | + | ||
| 42 | + @Query(nativeQuery = true, value = "select * from t_au_user where username = ?1") | ||
| 43 | + public List<SysUser> findByUserName(String userName); | ||
| 44 | + | ||
| 45 | + @Query(nativeQuery = true, value = "select * from t_au_user where report_to = ?1") | ||
| 46 | + public List<SysUser> findUserListByReportTo(Long userId); | ||
| 47 | + | ||
| 48 | + @Query(nativeQuery = true, value = "select login_name from t_au_user where report_to = ?1 and IS_VALID=1") | ||
| 49 | + public List<String> findLoginNameListByReportTo(Long userId); | ||
| 50 | + | ||
| 51 | + @Query(nativeQuery = true, value = "select * from t_au_user where is_valid=1 and VISIBLE=1") | ||
| 52 | + public List<SysUser> findAllUserListByValid(); | ||
| 53 | + | ||
| 54 | + @Query(nativeQuery = true ,value = " select * from T_AU_USER where id in (\n" + | ||
| 55 | + "select USER_ID from [dbo].[T_AU_USER_ROLES]\n" + | ||
| 56 | + " where ROLE_ID =?1\n" + | ||
| 57 | + " ) and is_valid=1 ;") | ||
| 58 | + public List<SysUser> findAllUserListByRole(Long roleId); | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * 根据用户ID查找用户信息 | ||
| 62 | + * @param userId | ||
| 63 | + * @return | ||
| 64 | + */ | ||
| 65 | + @Query(nativeQuery = true, value = "select * from t_au_user where id = ?1") | ||
| 66 | + public SysUser findUserById(Long userId); | ||
| 67 | + | ||
| 68 | + @Query(nativeQuery = true, value = "select * from t_au_user where TYPE_NAME ='客户' and login_name = ?1") | ||
| 69 | + public SysUser findUserByLoginNameFed(String loginName); | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * 查询员工账号 | ||
| 73 | + * @return | ||
| 74 | + */ | ||
| 75 | + @Query(nativeQuery = true,value = "select ID from T_AU_USER where IS_VALID = 1 AND ORG_NAME = 'RDE' AND CONS_DISTRIBUTION = '2'") | ||
| 76 | + public List<BigDecimal> findByDistribution(); | ||
| 77 | + | ||
| 78 | +} |
| ... | @@ -6,12 +6,10 @@ import com.erry.iclear.dateInterface.api.request.BasfcReceipt; | ... | @@ -6,12 +6,10 @@ import com.erry.iclear.dateInterface.api.request.BasfcReceipt; |
| 6 | import com.erry.iclear.dateInterface.api.request.Mawb; | 6 | import com.erry.iclear.dateInterface.api.request.Mawb; |
| 7 | import com.erry.iclear.dateInterface.api.response.ResultRS; | 7 | import com.erry.iclear.dateInterface.api.response.ResultRS; |
| 8 | import com.erry.iclear.dateInterface.common.Constant; | 8 | import com.erry.iclear.dateInterface.common.Constant; |
| 9 | -import com.erry.iclear.dateInterface.entity.ChmCarryPort; | 9 | +import com.erry.iclear.dateInterface.entity.*; |
| 10 | -import com.erry.iclear.dateInterface.entity.ChmConsignment; | ||
| 11 | -import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail; | ||
| 12 | -import com.erry.iclear.dateInterface.entity.DictionaryEntries; | ||
| 13 | import com.erry.iclear.dateInterface.repository.ChmConsignmentRepository; | 10 | import com.erry.iclear.dateInterface.repository.ChmConsignmentRepository; |
| 14 | import com.erry.iclear.dateInterface.repository.DictionaryEntriesRepository; | 11 | import com.erry.iclear.dateInterface.repository.DictionaryEntriesRepository; |
| 12 | +import com.erry.iclear.dateInterface.repository.SysUserRepository; | ||
| 15 | import com.erry.iclear.dateInterface.util.DateUtils; | 13 | import com.erry.iclear.dateInterface.util.DateUtils; |
| 16 | import com.erry.iclear.dateInterface.util.NumberUtils; | 14 | import com.erry.iclear.dateInterface.util.NumberUtils; |
| 17 | import com.erry.iclear.dateInterface.util.StringUtil; | 15 | import com.erry.iclear.dateInterface.util.StringUtil; |
| ... | @@ -48,6 +46,9 @@ public class ChmConsignmentService { | ... | @@ -48,6 +46,9 @@ public class ChmConsignmentService { |
| 48 | @Autowired | 46 | @Autowired |
| 49 | private DeclaredInfoService declaredInfoService; | 47 | private DeclaredInfoService declaredInfoService; |
| 50 | 48 | ||
| 49 | + @Autowired | ||
| 50 | + private SysUserRepository sysUserRepository; | ||
| 51 | + | ||
| 51 | /** | 52 | /** |
| 52 | * 转换主单 | 53 | * 转换主单 |
| 53 | * @return | 54 | * @return |
| ... | @@ -285,8 +286,11 @@ public class ChmConsignmentService { | ... | @@ -285,8 +286,11 @@ public class ChmConsignmentService { |
| 285 | //推送时间作为创建时间,可以用来校验数据的有序性,如果新的推送时间小于已有的创建时间,就不更新数据 | 286 | //推送时间作为创建时间,可以用来校验数据的有序性,如果新的推送时间小于已有的创建时间,就不更新数据 |
| 286 | result.setCreateTime(new Date()); | 287 | result.setCreateTime(new Date()); |
| 287 | result.setUpdateTime(pushTime); | 288 | result.setUpdateTime(pushTime); |
| 288 | - result.setCreator(creator); | 289 | + if (!creator.equals("IDE-ICLEAR-API")){ |
| 289 | - | 290 | + SysUser sysUser = sysUserRepository.findUserByLoginName(creator); |
| 291 | + result.setCreatorId(sysUser); | ||
| 292 | + result.setCreator(sysUser.getLoginName()); | ||
| 293 | + } | ||
| 290 | }catch (Exception e){ | 294 | }catch (Exception e){ |
| 291 | result=null; | 295 | result=null; |
| 292 | e.printStackTrace(); | 296 | e.printStackTrace(); |
| ... | @@ -633,10 +637,11 @@ public class ChmConsignmentService { | ... | @@ -633,10 +637,11 @@ public class ChmConsignmentService { |
| 633 | return result; | 637 | return result; |
| 634 | } | 638 | } |
| 635 | 639 | ||
| 636 | - public List<BasfcReceipt> getConsignmentCode(String[] consignmentCode) throws ParseException { | 640 | + public List<BasfcReceipt> getConsignmentCode(String[] consignmentCode,String creator) throws ParseException { |
| 637 | DictionaryEntries consTypeC = dictionaryEntriesRepository.findDictionaryEntriesByCode(Constant.consType_C); | 641 | DictionaryEntries consTypeC = dictionaryEntriesRepository.findDictionaryEntriesByCode(Constant.consType_C); |
| 642 | + SysUser sysUser = sysUserRepository.findUserByLoginName(creator); | ||
| 638 | List<String> stringList = declaredInfoService.stringList(consignmentCode); | 643 | List<String> stringList = declaredInfoService.stringList(consignmentCode); |
| 639 | - List<Object[]> chmByConsignmentCode = chmConsignmentRepository.findChmByConsignmentCode(stringList, consTypeC.getId()); | 644 | + List<Object[]> chmByConsignmentCode = chmConsignmentRepository.findChmByConsignmentCode(stringList, consTypeC.getId(),sysUser.getId()); |
| 640 | List<BasfcReceipt> basfcReceiptList = new ArrayList<>(); | 645 | List<BasfcReceipt> basfcReceiptList = new ArrayList<>(); |
| 641 | if(chmByConsignmentCode.size()>0){ | 646 | if(chmByConsignmentCode.size()>0){ |
| 642 | for (int i = 0; i < chmByConsignmentCode.size(); i++) { | 647 | for (int i = 0; i < chmByConsignmentCode.size(); i++) { | ... | ... |
| ... | @@ -3,8 +3,10 @@ package com.erry.iclear.dateInterface.service; | ... | @@ -3,8 +3,10 @@ package com.erry.iclear.dateInterface.service; |
| 3 | import com.erry.iclear.dateInterface.common.Constant; | 3 | import com.erry.iclear.dateInterface.common.Constant; |
| 4 | import com.erry.iclear.dateInterface.entity.DeclaredInfo; | 4 | import com.erry.iclear.dateInterface.entity.DeclaredInfo; |
| 5 | import com.erry.iclear.dateInterface.entity.DictionaryEntries; | 5 | import com.erry.iclear.dateInterface.entity.DictionaryEntries; |
| 6 | +import com.erry.iclear.dateInterface.entity.SysUser; | ||
| 6 | import com.erry.iclear.dateInterface.repository.DeclaredInfoRepository; | 7 | import com.erry.iclear.dateInterface.repository.DeclaredInfoRepository; |
| 7 | import com.erry.iclear.dateInterface.repository.DictionaryEntriesRepository; | 8 | import com.erry.iclear.dateInterface.repository.DictionaryEntriesRepository; |
| 9 | +import com.erry.iclear.dateInterface.repository.SysUserRepository; | ||
| 8 | import lombok.extern.slf4j.Slf4j; | 10 | import lombok.extern.slf4j.Slf4j; |
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
| ... | @@ -27,11 +29,15 @@ public class DeclaredInfoService { | ... | @@ -27,11 +29,15 @@ public class DeclaredInfoService { |
| 27 | @Autowired | 29 | @Autowired |
| 28 | private DictionaryEntriesRepository dictionaryEntriesRepository; | 30 | private DictionaryEntriesRepository dictionaryEntriesRepository; |
| 29 | 31 | ||
| 30 | - public List<DeclaredInfo> selectDeclaredInfo(String[] consignmentCode){ | 32 | + @Autowired |
| 33 | + private SysUserRepository sysUserRepository; | ||
| 34 | + | ||
| 35 | + public List<DeclaredInfo> selectDeclaredInfo(String[] consignmentCode, String creator){ | ||
| 31 | List<DeclaredInfo> DeclaredInfo = new ArrayList<>(); | 36 | List<DeclaredInfo> DeclaredInfo = new ArrayList<>(); |
| 32 | DictionaryEntries consTypeC = dictionaryEntriesRepository.findDictionaryEntriesByCode(Constant.consType_C); | 37 | DictionaryEntries consTypeC = dictionaryEntriesRepository.findDictionaryEntriesByCode(Constant.consType_C); |
| 38 | + SysUser sysUser = sysUserRepository.findUserByLoginName(creator); | ||
| 33 | List<String> consignmentCodeList = stringList(consignmentCode); | 39 | List<String> consignmentCodeList = stringList(consignmentCode); |
| 34 | - DeclaredInfo = declaredInfoRepository.getDeclaredInfoByAll(consignmentCodeList,consTypeC.getId()); | 40 | + DeclaredInfo = declaredInfoRepository.getDeclaredInfoByAll(consignmentCodeList,consTypeC.getId(),sysUser.getId()); |
| 35 | return DeclaredInfo; | 41 | return DeclaredInfo; |
| 36 | } | 42 | } |
| 37 | 43 | ... | ... |
-
Please register or login to post a comment