TsaGoodsService.java 80 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714
  1. package com.style24.admin.biz.service;
  2. import java.io.IOException;
  3. import java.text.SimpleDateFormat;
  4. import java.util.Collection;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.core.env.Environment;
  7. import org.springframework.stereotype.Service;
  8. import org.springframework.transaction.annotation.Transactional;
  9. import org.springframework.util.StringUtils;
  10. import com.fasterxml.jackson.core.type.TypeReference;
  11. import com.fasterxml.jackson.databind.ObjectMapper;
  12. import com.style24.admin.biz.dao.TsaGoodsDao;
  13. import com.style24.admin.support.env.TsaConstants;
  14. import com.style24.admin.support.security.session.TsaSession;
  15. import com.style24.core.biz.thirdparty.NaverLowestPriceApi;
  16. import com.style24.core.biz.thirdparty.SafetyKoreaApi;
  17. import com.style24.core.support.message.TscMessageByLocale;
  18. import com.style24.persistence.domain.AdKeyword;
  19. import com.style24.persistence.domain.AdKeywordGoods;
  20. import com.style24.persistence.domain.Brand;
  21. import com.style24.persistence.domain.Color;
  22. import com.style24.persistence.domain.FreeGoods;
  23. import com.style24.persistence.domain.Goods;
  24. import com.style24.persistence.domain.GoodsCompose;
  25. import com.style24.persistence.domain.GoodsDesc;
  26. import com.style24.persistence.domain.GoodsEpSkip;
  27. import com.style24.persistence.domain.GoodsHst;
  28. import com.style24.persistence.domain.GoodsImg;
  29. import com.style24.persistence.domain.GoodsNaverLowestPrice;
  30. import com.style24.persistence.domain.GoodsNotiInfo;
  31. import com.style24.persistence.domain.GoodsPriceRes;
  32. import com.style24.persistence.domain.GoodsResSell;
  33. import com.style24.persistence.domain.GoodsSafeNo;
  34. import com.style24.persistence.domain.GoodsSearch;
  35. import com.style24.persistence.domain.GoodsTnmRes;
  36. import com.style24.persistence.domain.GoodsVideo;
  37. import com.style24.persistence.domain.Itemkind;
  38. import com.style24.persistence.domain.NaverLowestPrice;
  39. import com.style24.persistence.domain.NotiInfo;
  40. import com.style24.persistence.domain.Notice;
  41. import com.style24.persistence.domain.NoticeGoods;
  42. import com.style24.persistence.domain.Option;
  43. import com.style24.persistence.domain.ReinboundInform;
  44. import com.style24.persistence.domain.SearchData;
  45. import com.style24.persistence.domain.Video;
  46. import com.style24.persistence.domain.WmsColorMapping;
  47. import com.style24.persistence.domain.WmsGoods;
  48. import com.style24.persistence.domain.WmsSeasonMapping;
  49. import com.style24.persistence.domain.WmsStyleYearMapping;
  50. import io.netty.util.internal.StringUtil;
  51. import lombok.extern.slf4j.Slf4j;
  52. import com.gagaframework.excel.GagaExcelUtil;
  53. import com.gagaframework.excel.env.GagaExcelConstants;
  54. import com.gagaframework.web.parameter.GagaMap;
  55. import com.gagaframework.web.util.GagaDateUtil;
  56. import com.gagaframework.web.util.GagaFileUtil;
  57. import com.gagaframework.web.util.GagaStringUtil;
  58. /**
  59. *상품관리 Service
  60. *
  61. * @author eskim
  62. * @since 2020. 10. 16
  63. */
  64. @Service
  65. @Slf4j
  66. public class TsaGoodsService {
  67. @Autowired
  68. private TscMessageByLocale message;
  69. @Autowired
  70. private Environment env;
  71. @Autowired
  72. private TsaGoodsDao goodsDao;
  73. @Autowired
  74. private TsaBusinessService businessService;
  75. @Autowired
  76. private TsaCommonService commonService;
  77. @Autowired
  78. private TsaRendererService rendererService;
  79. @Autowired
  80. private TsaNoticeService noticeService;
  81. @Autowired
  82. private SafetyKoreaApi safetyKoreaApi;
  83. @Autowired
  84. private NaverLowestPriceApi naverLowestPriceApi;
  85. @Autowired
  86. private ObjectMapper mapper;
  87. private static final String NUMBER_PATTERN = "^[0-9]+$";
  88. private static final String SELF_GOOODS_AFTER = "STY";
  89. /**
  90. * 상품 할인율 계산
  91. *
  92. * @param value
  93. * @param len
  94. * @param pad
  95. * @return
  96. */
  97. private long getDcRate(int listPrice, int currPrice) {
  98. double rate = (double)(currPrice) / (double)(listPrice);
  99. return 100 - (long)((Math.round(rate * 100) / 100.0) * 100);
  100. }
  101. /**
  102. * 품목 목록
  103. * @param itemkind
  104. * @return
  105. * @author eskim
  106. * @since 2020. 10. 16
  107. */
  108. public Collection<Itemkind> getItemkindList(Itemkind itemkind) {
  109. return goodsDao.getItemkindList(itemkind);
  110. }
  111. /**
  112. * 품목 저장
  113. *
  114. * @param itemkindList - 품목 정보 목록
  115. * @author eskim
  116. * @since 2020. 10. 16
  117. */
  118. @Transactional("shopTxnManager")
  119. public void saveItemkindInfo(Collection<Itemkind> itemkindList) {
  120. for (Itemkind itemkind : itemkindList) {
  121. itemkind.setRegNo(TsaSession.getInfo().getUserNo());
  122. itemkind.setUpdNo(TsaSession.getInfo().getUserNo());
  123. itemkind.setItemkindNm(GagaStringUtil.replace(GagaStringUtil.replace(itemkind.getItemkindNm(), "&lt;", "<"),"&gt;", ">"));
  124. //itemkind.setItemkindEnm(GagaStringUtil.replace(GagaStringUtil.replace(itemkind.getItemkindEnm(), "&lt;", "<"),"&gt;", ">"));
  125. goodsDao.saveItemkindInfo(itemkind);
  126. }
  127. }
  128. /**
  129. * 품목 삭제
  130. *
  131. * @param itemkindList - 품목 정보 목록
  132. * @author eskim
  133. * @since 2020. 10. 16
  134. */
  135. @Transactional("shopTxnManager")
  136. public void deleteItemkindInfo(Collection<Itemkind> itemkindList) {
  137. for (Itemkind itemkind : itemkindList) {
  138. goodsDao.deleteItemkindInfo(itemkind);
  139. }
  140. }
  141. /**
  142. * 색상목록 조회
  143. *
  144. * @param color
  145. * @return
  146. * @author eskim
  147. * @since 2020. 10. 16
  148. */
  149. public Collection<Color> getColorList(Color color) {
  150. return goodsDao.getColorList(color);
  151. }
  152. /**
  153. * 색상 저장
  154. *
  155. * @param colorList
  156. * @return
  157. * @author eskim
  158. * @since 2020. 10. 16
  159. */
  160. @Transactional("shopTxnManager")
  161. public void saveColor(Collection<Color> colorList) {
  162. for (Color color : colorList) {
  163. color.setRegNo(TsaSession.getInfo().getUserNo());
  164. color.setUpdNo(TsaSession.getInfo().getUserNo());
  165. goodsDao.saveColor(color);
  166. }
  167. }
  168. /**
  169. * 상품정보고시 목록
  170. *
  171. * @param notiInfo
  172. * @return
  173. * @author eskim
  174. * @since 2010. 10. 19
  175. */
  176. public Collection<NotiInfo> getNotiInfoList(NotiInfo notiInfo) {
  177. return goodsDao.getNotiInfoList(notiInfo);
  178. }
  179. /**
  180. * 상품정보고시 항목 목록
  181. *
  182. * @param notiInfo
  183. * @return
  184. * @author eskim
  185. * @since 2010. 10. 19
  186. */
  187. public Collection<NotiInfo> getNotiInfoItemList(NotiInfo notiInfo) {
  188. return goodsDao.getNotiInfoItemList(notiInfo);
  189. }
  190. /**
  191. * 상품정보고시 항목 저장
  192. *
  193. * @param notiInfoList
  194. * @return
  195. * @author eskim
  196. * @since 2010. 10. 19
  197. */
  198. @Transactional("shopTxnManager")
  199. public void saveNotiInfoItem(Collection<NotiInfo> notiInfoList) {
  200. if (notiInfoList == null || notiInfoList.isEmpty())
  201. throw new IllegalStateException(message.getMessage("FAIL_1001"));
  202. for (NotiInfo notiInfo : notiInfoList) {
  203. if (!StringUtils.isEmpty(notiInfo.getNiContent())) {
  204. notiInfo.setNiContent(GagaStringUtil.replace(GagaStringUtil.replace(notiInfo.getNiContent(),"&lt;", "<"),"&gt;", ">"));
  205. }
  206. notiInfo.setRegNo(TsaSession.getInfo().getUserNo());
  207. notiInfo.setUpdNo(TsaSession.getInfo().getUserNo());
  208. goodsDao.saveNotiInfo(notiInfo);
  209. }
  210. }
  211. /**
  212. * WMS 색상 매핑목록 조회
  213. *
  214. * @param color
  215. * @return
  216. * @author eskim
  217. * @since 2020. 10. 16
  218. */
  219. public Collection<WmsColorMapping> getWmsColorMappingList(WmsColorMapping wmsColorMapping) {
  220. return goodsDao.getWmsColorMappingList(wmsColorMapping);
  221. }
  222. /**
  223. * WMS 색상 매핑 저장
  224. *
  225. * @param colorList
  226. * @return
  227. * @author eskim
  228. * @since 2020. 10. 16
  229. */
  230. @Transactional("shopTxnManager")
  231. public void saveWmsColorMapping(Collection<WmsColorMapping> wmsColorMappingList) {
  232. for (WmsColorMapping wmsColorMapping : wmsColorMappingList) {
  233. wmsColorMapping.setRegNo(TsaSession.getInfo().getUserNo());
  234. wmsColorMapping.setUpdNo(TsaSession.getInfo().getUserNo());
  235. goodsDao.saveWmsColorMapping(wmsColorMapping);
  236. }
  237. }
  238. /**
  239. * WMS 스타일년도 매핑목록 조회
  240. *
  241. * @param wmsStyleYearMapping
  242. * @return
  243. * @author eskim
  244. * @since 2020. 11. 13
  245. */
  246. public Collection<WmsStyleYearMapping> getWmsStyleYearMappingList(WmsStyleYearMapping wmsStyleYearMapping) {
  247. return goodsDao.getWmsStyleYearMappingList(wmsStyleYearMapping);
  248. }
  249. /**
  250. * WMS 스타일년도 매핑 저장
  251. *
  252. * @param wmsStyleYearMappingList
  253. * @return
  254. * @author eskim
  255. * @since 2020. 11. 13
  256. */
  257. @Transactional("shopTxnManager")
  258. public void saveWmsStyleYearMapping(Collection<WmsStyleYearMapping> wmsStyleYearMappingList) {
  259. for (WmsStyleYearMapping wmsStyleYearMapping : wmsStyleYearMappingList) {
  260. wmsStyleYearMapping.setRegNo(TsaSession.getInfo().getUserNo());
  261. wmsStyleYearMapping.setUpdNo(TsaSession.getInfo().getUserNo());
  262. goodsDao.saveWmsStyleYearMapping(wmsStyleYearMapping);
  263. }
  264. }
  265. /**
  266. * WMS 시즌 매핑목록 조회
  267. *
  268. * @param wmsSeasonMapping
  269. * @return
  270. * @author eskim
  271. * @since 2020. 11. 13
  272. */
  273. public Collection<WmsSeasonMapping> getWmsSeasonMappingList(WmsSeasonMapping wmsSeasonMapping) {
  274. return goodsDao.getWmsSeasonMappingList(wmsSeasonMapping);
  275. }
  276. /**
  277. * WMS 시즌 매핑 저장
  278. *
  279. * @param wmsSeasonMappingList
  280. * @return
  281. * @author eskim
  282. * @since 2020. 11. 13
  283. */
  284. @Transactional("shopTxnManager")
  285. public void saveWmsSeasonMapping(Collection<WmsSeasonMapping> wmsSeasonMappingList) {
  286. for (WmsSeasonMapping wmsSeasonMapping : wmsSeasonMappingList) {
  287. wmsSeasonMapping.setRegNo(TsaSession.getInfo().getUserNo());
  288. wmsSeasonMapping.setUpdNo(TsaSession.getInfo().getUserNo());
  289. goodsDao.saveWmsSeasonMapping(wmsSeasonMapping);
  290. }
  291. }
  292. /**
  293. * 상품 목록 건수
  294. *
  295. * @param goodsSearch
  296. * @return
  297. * @author eskim
  298. * @since 2020. 10. 20
  299. */
  300. public int getGoodsListCount(GoodsSearch goodsSearch) {
  301. return goodsDao.getGoodsListCount(goodsSearch);
  302. }
  303. /**
  304. * 상품 목록
  305. *
  306. * @param goodsSearch
  307. * @return
  308. * @author eskim
  309. * @since 2020. 10. 20
  310. */
  311. public Collection<Goods> getGoodsList(GoodsSearch goodsSearch) {
  312. return goodsDao.getGoodsList(goodsSearch);
  313. }
  314. /**
  315. * 상품목록 - 기본정보 엑셀다운로드
  316. *
  317. * @param goodsSearch
  318. * @param excelFilenameWithPath - 경로를 포함한 엑셀파일명
  319. * @return
  320. * @author eskim
  321. * @since 2020. 10. 21
  322. */
  323. public void getGoodsInfoExcelList(GoodsSearch goodsSearch, String excelFilenameWithPath) {
  324. if ("Y".equals(goodsSearch.getImageViewYn())) {
  325. // 헤더 title 설정
  326. String[] listTitles = {"이미지", "상품코드", "업체명", "브랜드명", "상품명", "품목", "재고", "상품상태", "스타일년도", "시즌",
  327. "정상가", "판매가", "할인율", "가격변경일", "ERP재고연동여부", "정상이월구분", "반품가능 여부","승인일시"};
  328. // DB 처리 시 사용되는 파라미터명(셀명) 설정
  329. String[] cellNames = {"SYS_IMG_NM", "GOODS_CD", "SUPPLY_COMP_CD", "BRAND_GRP_NM", "GOODS_NM", "ITEMKIND_NM",
  330. "STOCK_QTY_SUM", "GOODS_STAT", "STYLE_YEAR", "SEASON_CD", "LIST_PRICE", "CURR_PRICE",
  331. "DC_RATE", "PRICE_UPD_DT", "ERP_STOCK_LINK_YN", "FORMAL_GB", "RETURNABLE_YN", "FRST_CFRM_DT"};
  332. String[] cellTypes = {GagaExcelConstants.CellType.IMAGE.name(),
  333. GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
  334. GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
  335. GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_RIGHT.name(),
  336. GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
  337. GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_RIGHT.name(),
  338. GagaExcelConstants.CellType.CHAR_RIGHT.name(), GagaExcelConstants.CellType.CHAR_RIGHT.name(),
  339. GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
  340. GagaExcelConstants.CellType.CHAR_CENTER.name(),
  341. GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name()};
  342. String targetPath = env.getProperty("upload.goods.view");
  343. Collection<GagaMap> dataList = goodsDao.getGoodsInfoExcelList(goodsSearch); // map형식으로 조회
  344. if (dataList != null && !dataList.isEmpty()) {
  345. for (GagaMap gagaMap : dataList) {
  346. if (!StringUtils.isEmpty(gagaMap.get("SYS_IMG_NM").toString()) ) {
  347. gagaMap.set("SYS_IMG_NM", targetPath + '/' + gagaMap.get("SYS_IMG_NM").toString());
  348. }
  349. }
  350. }
  351. try {
  352. GagaExcelUtil.createExcel(excelFilenameWithPath, dataList, "상품 정보", listTitles, cellNames, cellTypes, TsaConstants.EXCEL_FOOTER_TITLE);
  353. } catch (Exception e) {
  354. throw new IllegalStateException(e);
  355. }
  356. } else {
  357. // 헤더 title 설정
  358. String[] listTitles = {"상품코드", "업체명", "브랜드명", "상품명", "품목", "재고", "상품상태", "스타일년도",
  359. "시즌", "정상가", "판매가", "할인율", "가격변경일", "ERP재고연동여부", "정상이월구분", "반품가능 여부", "승인일시"};
  360. // DB 처리 시 사용되는 파라미터명(셀명) 설정
  361. String[] cellNames = {"GOODS_CD", "SUPPLY_COMP_CD", "BRAND_GRP_NM", "GOODS_NM", "ITEMKIND_NM", "STOCK_QTY_SUM", "GOODS_STAT", "STYLE_YEAR",
  362. "SEASON_CD", "LIST_PRICE", "CURR_PRICE", "DC_RATE", "PRICE_UPD_DT", "ERP_STOCK_LINK_YN", "FORMAL_GB", "RETURNABLE_YN", "FRST_CFRM_DT"};
  363. String[] cellTypes = {
  364. GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
  365. GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
  366. GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_RIGHT.name(),
  367. GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
  368. GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_RIGHT.name(),
  369. GagaExcelConstants.CellType.CHAR_RIGHT.name(), GagaExcelConstants.CellType.CHAR_RIGHT.name(),
  370. GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
  371. GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
  372. GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name()};
  373. Collection<GagaMap> dataList = goodsDao.getGoodsInfoExcelList(goodsSearch);
  374. try {
  375. GagaExcelUtil.createExcel(excelFilenameWithPath, dataList, "상품 정보", listTitles, cellNames, cellTypes, TsaConstants.EXCEL_FOOTER_TITLE);
  376. } catch (Exception e) {
  377. throw new IllegalStateException(e);
  378. }
  379. }
  380. }
  381. /**
  382. * 상품 이미지 등록여부 조회
  383. *
  384. * @param goods
  385. * @return
  386. * @author eskim
  387. * @since 2020. 10. 21
  388. */
  389. public Collection<Goods> getGoodsImgsYn(Goods goods) {
  390. return goodsDao.getGoodsImgsYn(goods);
  391. }
  392. /**
  393. * 상품 상세
  394. *
  395. * @param goods
  396. * @return
  397. * @author eskim
  398. * @since 2020. 10. 22
  399. */
  400. public Goods getGoods(Goods goods) {
  401. // 상품기본정보
  402. Goods resultGoods = goodsDao.getGoods(goods);
  403. // 상품 상세
  404. this.getGoodsDesc(resultGoods);
  405. return resultGoods;
  406. }
  407. /**
  408. * 상품 상세 조회
  409. *
  410. * @param resultGoods
  411. * @return
  412. * @author eskim
  413. * @since 2020. 10. 22
  414. */
  415. private Goods getGoodsDesc(Goods resultGoods) {
  416. GoodsDesc goods = new GoodsDesc();
  417. goods.setGoodsCd(resultGoods.getGoodsCd());
  418. // 상품 상세 타이틀
  419. goods.setDescGb("10");
  420. String goodsTitlesDesc = this.getGoodsDescList(goods);
  421. resultGoods.setGoodsTitlesDesc(goodsTitlesDesc);
  422. // 상품 상세 내용
  423. goods.setDescGb("20");
  424. String goodsContentsDesc = this.getGoodsDescList(goods);
  425. resultGoods.setGoodsContentsDesc(goodsContentsDesc);
  426. // 상품 상세 특징
  427. goods.setDescGb("30");
  428. String goodsCharacterDesc = this.getGoodsDescList(goods);
  429. resultGoods.setGoodsCharacterDesc(goodsCharacterDesc);
  430. // 상품 상세 pc 상단
  431. goods.setDescGb("40");
  432. String goodsPcTopDesc = this.getGoodsDescList(goods);
  433. resultGoods.setGoodsPcTopDesc(goodsPcTopDesc);
  434. // 상품 상세 pc 하단
  435. goods.setDescGb("50");
  436. String goodsPcDownDesc = this.getGoodsDescList(goods);
  437. resultGoods.setGoodsPcDownDesc(goodsPcDownDesc);
  438. // 상품 상세 mobile 상단
  439. goods.setDescGb("60");
  440. String goodsMobileTopDesc = this.getGoodsDescList(goods);
  441. resultGoods.setGoodsMobileTopDesc(goodsMobileTopDesc);
  442. // 상품 상세 mobile 하단
  443. goods.setDescGb("70");
  444. String goodsMobileDownDesc = this.getGoodsDescList(goods);
  445. resultGoods.setGoodsMobileDownDesc(goodsMobileDownDesc);
  446. return resultGoods;
  447. }
  448. /**
  449. * 상품 상세구분별 컨텐츠 조회
  450. *
  451. * @param goods
  452. * @return
  453. * @author eskim
  454. * @since 2020. 10. 22
  455. */
  456. private String getGoodsDescList(GoodsDesc goodsDesc) {
  457. Collection<GoodsDesc> goodsDescList = goodsDao.getGoodsDescList(goodsDesc);
  458. StringBuilder goodsDescSb = new StringBuilder();
  459. if (goodsDescList != null && !goodsDescList.isEmpty()) {
  460. for (GoodsDesc tmpGoodsDesc : goodsDescList) {
  461. goodsDescSb.append(tmpGoodsDesc.getGoodsDesc());
  462. }
  463. }else {
  464. goodsDescSb.append("");
  465. }
  466. return goodsDescSb.toString();
  467. }
  468. /**
  469. * 상품 정보 이력 조회
  470. *
  471. * @param goods
  472. * @return
  473. * @author eskim
  474. * @since 2019. 12. 12
  475. */
  476. public Collection<GoodsHst> getGoodsHstList(Goods goods) {
  477. return goodsDao.getGoodsHstList(goods);
  478. }
  479. /**
  480. * 상품 옵션 조회
  481. *
  482. * @param goods
  483. * @return
  484. * @author eskim
  485. * @since 2020. 10. 26
  486. */
  487. public Collection<Option> getGoodsSizeList(Goods goods) {
  488. return goodsDao.getGoodsSizeList(goods);
  489. }
  490. /**
  491. * 상품 색상목록 조회
  492. *
  493. * @param goods
  494. * @return
  495. * @author eskim
  496. * @since 2020. 11. 18
  497. */
  498. public Collection<GoodsImg> getGoodsColorList(Goods goods) {
  499. return goodsDao.getGoodsColorList(goods);
  500. }
  501. /**
  502. * 상품 정보고시 조회
  503. *
  504. * @param goods
  505. * @return
  506. * @author eskim
  507. * @since 2020. 10. 22
  508. */
  509. public Collection<GoodsNotiInfo> getGoodsNotiInfoList(GoodsNotiInfo goodsNotiInfo) {
  510. return goodsDao.getGoodsNotiInfoList(goodsNotiInfo);
  511. }
  512. /**
  513. * 상품의 정보고시 항목 목록
  514. *
  515. * @param notiInfo
  516. * @return
  517. * @author eskim
  518. * @since 2020. 11. 18
  519. */
  520. public Collection<NotiInfo> getNotiGoodsInfoList(NotiInfo notiInfo) {
  521. return goodsDao.getNotiGoodsInfoList(notiInfo);
  522. }
  523. /**
  524. * 상품 구매등급 조회
  525. *
  526. * @param goods
  527. * @return
  528. * @author eskim
  529. * @since 2020. 11. 18
  530. */
  531. public Collection<Goods> getGoodsDetailOrderGradeList(Goods goods) {
  532. return goodsDao.getGoodsDetailOrderGradeList(goods);
  533. }
  534. /**
  535. * 구성상품 목록
  536. *
  537. * @param goods
  538. * @return
  539. * @author eskim
  540. * @since 2020. 10. 27
  541. */
  542. public Collection<GoodsCompose> getGoodsDetailComposeList(Goods goods) {
  543. return goodsDao.getGoodsDetailComposeList(goods);
  544. }
  545. /**
  546. * 안전인증번호
  547. *
  548. * @param goods
  549. * @return
  550. * @author eskim
  551. * @since 2020. 12. 07
  552. */
  553. public GagaMap getGoodsDetailCertNum(String goodsCd) {
  554. GagaMap result = new GagaMap();
  555. return result;
  556. }
  557. /**
  558. * 안전인증번호 저장
  559. *
  560. * @param goods
  561. * @return
  562. * @author eskim
  563. * @since 2020. 12. 07
  564. */
  565. @Transactional("shopTxnManager")
  566. public void saveGoodsDetailCertNum(Goods goods) {
  567. try {
  568. GagaMap result = safetyKoreaApi.getKoreaCertifyDetail(goods.getCertNum());
  569. if (result != null || !StringUtil.isNullOrEmpty(result.get("certNum").toString())) {
  570. GoodsSafeNo goodsSafeNo = new GoodsSafeNo();
  571. goodsSafeNo.setGoodsCd(goods.getGoodsCd());
  572. goodsSafeNo.setCertDt(result.get("certDt").toString());
  573. goodsSafeNo.setCertNum(result.get("certNum").toString());
  574. goodsSafeNo.setCertState(result.get("certState").toString());
  575. goodsSafeNo.setCertDiv(result.get("certDiv").toString());
  576. goodsSafeNo.setRegNo(TsaSession.getInfo().getUserNo());
  577. goodsSafeNo.setUpdNo(TsaSession.getInfo().getUserNo());
  578. goodsDao.saveGoodsSafeNo(goodsSafeNo);
  579. }
  580. } catch (Exception e) {
  581. e.printStackTrace();
  582. }
  583. }
  584. /**
  585. * 상품 수정 항목 일괄변경
  586. *
  587. * @param goods
  588. * @author eskim
  589. * @since 2020. 01. 17
  590. */
  591. @Transactional("shopTxnManager")
  592. public void updateGoodsState(Goods goods) {
  593. if (goods == null || (goods.getArrGoodsCd() == null && goods.getArrGoodsCd().length <= 0)) {
  594. throw new IllegalStateException(message.getMessage("FAIL_1001"));
  595. }
  596. goods.setRegNo(TsaSession.getInfo().getUserNo());
  597. goods.setUpdNo(TsaSession.getInfo().getUserNo());
  598. if (goods.getArrGoodsCd().length > 0) {
  599. for (String goodsCd : goods.getArrGoodsCd()) {
  600. goods.setGoodsCd(goodsCd);
  601. // 이력생성
  602. goodsDao.createGoodsHst(goods);
  603. if ("formalGb".equals(goods.getProcJob())) {
  604. // 상품브랜드 조회
  605. Goods originGoods = goodsDao.getGoods(goods);
  606. // 브랜드 확인
  607. goods.setPntPrate(originGoods.getPntPrate()); // 포인트적립율(PC)
  608. goods.setPntMrate(originGoods.getPntMrate()); // 포인트적립율(MOBILE)
  609. Brand brand = new Brand();
  610. brand.setBrandCd(originGoods.getBrandCd());
  611. Collection<Brand> brandList = businessService.getBrandList(brand);
  612. if (brandList != null && !brandList.isEmpty()) {
  613. float pntPrate = 0;
  614. float pntMrate = 0;
  615. for (Brand tmpBrand : brandList) {
  616. if ("G009_10".equals(goods.getFormalGb())) {
  617. pntPrate = tmpBrand.getPntPrate10();
  618. pntMrate = tmpBrand.getPntMrate10();
  619. } else {
  620. pntPrate = tmpBrand.getPntPrate20();
  621. pntMrate = tmpBrand.getPntMrate20();
  622. }
  623. }
  624. goods.setPntPrate(pntPrate); // 포인트적립율(PC)
  625. goods.setPntMrate(pntMrate); // 포인트적립율(MOBILE)
  626. }
  627. } else if ("goodsStat".equals(goods.getProcJob())) {
  628. // 상품브랜드 조회
  629. Goods originGoods = goodsDao.getGoods(goods);
  630. // 승인일
  631. if (!goods.getGoodsStat().equals(originGoods.getGoodsStat()) && "G008_90".equals(goods.getGoodsStat())) {
  632. goods.setChGoodsStatYn("Y");
  633. }
  634. }
  635. // 상품정보 변경
  636. goodsDao.updateGoodsState(goods);
  637. }
  638. } else {
  639. // 이력생성
  640. goodsDao.createGoodsHst(goods);
  641. if ("formalGb".equals(goods.getProcJob())) {
  642. // 상품브랜드 조회
  643. Goods originGoods = goodsDao.getGoods(goods);
  644. // 브랜드 확인
  645. goods.setPntPrate(originGoods.getPntPrate()); // 포인트적립율(PC)
  646. goods.setPntMrate(originGoods.getPntMrate()); // 포인트적립율(MOBILE)
  647. Brand brand = new Brand();
  648. brand.setBrandCd(originGoods.getBrandCd());
  649. Collection<Brand> brandList = businessService.getBrandList(brand);
  650. if (brandList != null && !brandList.isEmpty()) {
  651. float pntPrate = 0;
  652. float pntMrate = 0;
  653. for (Brand tmpBrand : brandList) {
  654. if ("G009_10".equals(goods.getFormalGb())) {
  655. pntPrate = tmpBrand.getPntPrate10();
  656. pntMrate = tmpBrand.getPntMrate10();
  657. } else {
  658. pntPrate = tmpBrand.getPntPrate20();
  659. pntMrate = tmpBrand.getPntMrate20();
  660. }
  661. }
  662. goods.setPntPrate(pntPrate); // 포인트적립율(PC)
  663. goods.setPntMrate(pntMrate); // 포인트적립율(MOBILE)
  664. }
  665. }
  666. // 상품정보 변경
  667. goodsDao.updateGoodsState(goods);
  668. }
  669. }
  670. /**
  671. * 엑셀조회용 상품 저장
  672. *
  673. * @param procJob : goodsExcelUpload
  674. * @param goodsList
  675. * @return
  676. * @author eskim
  677. * @since 2020. 10. 22
  678. */
  679. @Transactional("shopTxnManager")
  680. public void saveExceluploadGoods(Collection<Goods> goodsList, String excelFilename) {
  681. String targetPath = GagaFileUtil.getConcatenationPath(env.getProperty("upload.excel.target.path"), "excel");
  682. if (goodsList == null || goodsList.isEmpty()) {
  683. this.deleteExceluploadFile(targetPath, excelFilename);
  684. throw new IllegalStateException(message.getMessage("FAIL_1001"));
  685. }
  686. int index = 0;
  687. String goodsCdFlag = "";
  688. String goodsNumFlag = "";
  689. for (Goods goods : goodsList) {
  690. if (!StringUtils.isEmpty(goodsCdFlag) && !StringUtils.isEmpty(goodsNumFlag)) {
  691. throw new IllegalStateException("상품코드와 원코드 중 한 개의 셀에만 값을 입력해서 조회하세요.");
  692. }
  693. if (!StringUtils.isEmpty(goods.getSupplyCompCd())) {
  694. goods.setGoodsCd(goods.getSupplyCompCd());
  695. }
  696. SearchData searchData = new SearchData();
  697. searchData.setRegNo(goods.getRegNo());
  698. searchData.setSearchCd(goods.getGoodsCd());
  699. if (index == 0) {
  700. commonService.deleteExceluploadSearCh(searchData);
  701. }
  702. commonService.createExceluploadSearch(searchData);
  703. index++;
  704. }
  705. }
  706. /**
  707. * 파일 삭제
  708. *
  709. * @param targetPath
  710. * @param excelFilename
  711. * @author eskim
  712. * @since 2020. 10. 22
  713. */
  714. private void deleteExceluploadFile(String targetPath, String excelFilename) {
  715. // 파일 삭제
  716. try {
  717. GagaFileUtil.deleteFile(GagaFileUtil.getConcatenationPath(targetPath, excelFilename));
  718. } catch (IOException e) {
  719. // Nothing Do
  720. }
  721. }
  722. /**
  723. * 상품 품목 변경 저장
  724. *
  725. * @param goodsList
  726. * @return
  727. * @author eskim
  728. * @since 2020. 10. 23
  729. */
  730. @Transactional("shopTxnManager")
  731. //@CacheEvict(value = "cate", allEntries = true)
  732. public void saveItemKindChange(Collection<Goods> goodsList) {
  733. for (Goods goods : goodsList) {
  734. goods.setRegNo(TsaSession.getInfo().getUserNo());
  735. goods.setUpdNo(TsaSession.getInfo().getUserNo());
  736. goods.setItemkindCd(goods.getItemkindCd().toUpperCase());
  737. // 품목확인
  738. Itemkind itemkind = new Itemkind();
  739. itemkind.setItemkindCd(goods.getItemkindCd());
  740. itemkind.setUseYn("Y");
  741. Collection<Itemkind> itemkindList = goodsDao.getItemkindList(itemkind);
  742. if (itemkindList == null || itemkindList.isEmpty()) {
  743. throw new IllegalStateException(goods.getGoodsCd() + " 상품의 품목코드를 확인해주세요.");
  744. }
  745. // 상품이력
  746. goodsDao.createGoodsHst(goods);
  747. // 품목변경
  748. goodsDao.updateGoodItemKindCd(goods);
  749. // 검색어 변경
  750. String goodsSnm = goodsDao.getGoodsSnm(goods.getGoodsCd());
  751. Goods tmpGoods = goodsDao.getGoods(goods);
  752. if (tmpGoods != null && !StringUtils.isEmpty(tmpGoods.getGoodsSnm1())) {
  753. String[] arrGoodsSnm = tmpGoods.getGoodsSnm1().split(";");
  754. StringBuilder tempGoodsSnm = new StringBuilder();
  755. for (String loopGoodsSnm : arrGoodsSnm) {
  756. if (goodsSnm.toUpperCase().indexOf(loopGoodsSnm.toUpperCase()) <= -1) {
  757. tempGoodsSnm.append(loopGoodsSnm).append(";");
  758. }
  759. }
  760. goods.setGoodsSnm(tempGoodsSnm.toString() + goodsSnm);
  761. } else {
  762. goods.setGoodsSnm(goodsSnm);
  763. }
  764. goodsDao.updateGoodsSnm(goods);
  765. Collection<GoodsNotiInfo> goodsNotiInfoList = goodsDao.getNewNotiInfo(goods);
  766. goodsDao.deleteGoodsNotiInfo(goods);
  767. for (GoodsNotiInfo goodsNotiInfo : goodsNotiInfoList) {
  768. goodsNotiInfo.setRegNo(TsaSession.getInfo().getUserNo());
  769. goodsNotiInfo.setUpdNo(TsaSession.getInfo().getUserNo());
  770. goodsNotiInfo.setGoodsCd(goods.getGoodsCd());
  771. goodsDao.saveGoodsNotiInfo(goodsNotiInfo);
  772. }
  773. this.saveGoodsCategory(goods);
  774. }
  775. }
  776. /**
  777. * 상품 품목 기준 카테고리 저장
  778. *
  779. * @param goods
  780. * @author eskim
  781. * @since 2020. 4. 21.
  782. */
  783. private void saveGoodsCategory(Goods goods) {
  784. // GoodsCategory goodsCategory = new GoodsCategory();
  785. // goodsCategory.setRegNo(TsaSession.getInfo().getUserNo());
  786. // goodsCategory.setUpdNo(TsaSession.getInfo().getUserNo());
  787. // goodsCategory.setGoodsCd(goods.getGoodsCd());
  788. // displayService.deleteGoodsCategory(goodsCategory);
  789. //
  790. // Collection<ItemkindCategory> itemkindCategoryList = displayService.getItemkindCategoryList(goods.getItemkindCd());
  791. // for ItemkindCategory itemkindCategory : itemkindCategoryList) {
  792. // Category category = new Category();
  793. // category.setCateGb(itemkindCategory.getCateGb());
  794. // category.setCateCd(itemkindCategory.getCateCd());
  795. // category = displayService.getCategory4srch(category);
  796. //
  797. // CategoryGoods categoryGoods = new CategoryGoods();
  798. // categoryGoods.setRegNo(TsaSession.getInfo().getUserNo());
  799. // categoryGoods.setUpdNo(TsaSession.getInfo().getUserNo());
  800. // String[] goodsCdArr = {goods.getGoodsCd()};
  801. // categoryGoods.setGoodsCdArr(goodsCdArr);
  802. // if (category.getCateGb() != null) {
  803. // categoryGoods.setNcateGb(String.valueOf(category.getCateGb()));
  804. // }
  805. // if (category.getCateType() != null) {
  806. // categoryGoods.setNcateType(String.valueOf(category.getCateType()));
  807. // }
  808. // if (category.getCateCd() != null) {
  809. // categoryGoods.setNcateCd(String.valueOf(category.getCateCd()));
  810. // }
  811. // if (category.getTcateCd() != null) {
  812. // categoryGoods.setNtcateCd(String.valueOf(category.getTcateCd()));
  813. // }
  814. // if (category.getMcateCd() != null) {
  815. // categoryGoods.setNmcateCd(String.valueOf(category.getMcateCd()));
  816. // }
  817. // if (category.getScateCd() != null) {
  818. // categoryGoods.setNscateCd(String.valueOf(category.getScateCd()));
  819. // }
  820. // if (category.getDcateCd() != null) {
  821. // categoryGoods.setNdcateCd(String.valueOf(category.getDcateCd()));
  822. // }
  823. // displayService.moveCategoryGoods(categoryGoods);
  824. // }
  825. }
  826. /**
  827. * 상품 저장
  828. *
  829. * @param goods
  830. * @return
  831. * @author eskim
  832. * @since 2020. 10. 27
  833. */
  834. @Transactional("shopTxnManager")
  835. public void saveGoodsDetail(Goods goods) {
  836. // <,> replace 처리
  837. goods.setRegNo(TsaSession.getInfo().getUserNo());
  838. goods.setUpdNo(TsaSession.getInfo().getUserNo());
  839. goods.setGoodsPcTopDesc(GagaStringUtil.replace(GagaStringUtil.replace(goods.getGoodsPcTopDesc(), "&lt;", "<"), "&gt;", ">"));
  840. goods.setGoodsMobileTopDesc(GagaStringUtil.replace(GagaStringUtil.replace(goods.getGoodsMobileTopDesc(), "&lt;", "<"), "&gt;", ">"));
  841. goods.setGoodsPcDownDesc(GagaStringUtil.replace(GagaStringUtil.replace(goods.getGoodsPcDownDesc(), "&lt;", "<"), "&gt;", ">"));
  842. goods.setGoodsMobileDownDesc(GagaStringUtil.replace(GagaStringUtil.replace(goods.getGoodsMobileDownDesc(), "&lt;", "<"), "&gt;", ">"));
  843. goods.setGoodsNm(GagaStringUtil.replace(GagaStringUtil.replace(goods.getGoodsNm(), "&lt;", "<"), "&gt;", ">"));
  844. goods.setGoodsTnm(GagaStringUtil.replace(GagaStringUtil.replace(goods.getGoodsTnm(), "&lt;", "<"), "&gt;", ">"));
  845. goods.setGoodsSnm1(GagaStringUtil.replace(GagaStringUtil.replace(goods.getGoodsSnm1(), "&lt;", "<"), "&gt;", ">"));
  846. // 딜상품의 대표상품 변경여부 확인
  847. if ("G056_D".equals(goods.getGoodsType())) {
  848. String newRepGoodsCd = "";
  849. int newRepGoodsPrice = 0;
  850. Collection<GoodsCompose> goodsExtendList = goods.getGoodsComposeListNew();
  851. for (GoodsCompose regGoodsExtend : goodsExtendList) {
  852. if ("Y".equals(regGoodsExtend.getRepYn())) {
  853. newRepGoodsCd = regGoodsExtend.getCompsGoodsCd();
  854. newRepGoodsPrice = regGoodsExtend.getCurrPrice();
  855. }
  856. }
  857. log.info("newRepGoodsCd = {}, newRepGoodsPrice = {}, goods.getRepGoodsCd = {}", newRepGoodsCd, newRepGoodsPrice, goods.getRepGoodsCd());
  858. // 1순 : 대표상품 변경, 2순 : 판매가 변경
  859. if (!newRepGoodsCd.equals(goods.getRepGoodsCd())) {
  860. goods.setCurrBprice(goods.getCurrPriceOrg());
  861. goods.setCurrPrice(newRepGoodsPrice);
  862. goods.setListPrice(newRepGoodsPrice);
  863. goods.setDcRate(0);
  864. goods.setChDataYn("Y");
  865. }else {
  866. if (goods.getCurrPrice() != goods.getCurrPriceOrg()) {
  867. goods.setCurrBprice(goods.getCurrPriceOrg());
  868. goods.setListPrice(goods.getCurrPrice());
  869. goods.setDcRate(0);
  870. }
  871. }
  872. }else {
  873. // 가격변경일
  874. if (goods.getCurrPrice() != goods.getCurrPriceOrg()) {
  875. goods.setCurrBprice(goods.getCurrPriceOrg());
  876. } else {
  877. goods.setCurrPrice(goods.getCurrPriceOrg());
  878. }
  879. }
  880. // 승인일
  881. if (!goods.getGoodsStat().equals(goods.getGoodsStatOrg()) && "G008_90".equals(goods.getGoodsStat())) {
  882. goods.setChGoodsStatYn("Y");
  883. }
  884. // 사용자 검색어를 검색어에 적용
  885. String goodsSnm = goodsDao.getGoodsSnm(goods.getGoodsCd());
  886. if (!StringUtils.isEmpty(goods.getGoodsSnm1())) {
  887. goods.setGoodsSnm1(GagaStringUtil.replace(goods.getGoodsSnm1(), " ", "")); // 빈값 삭제
  888. String[] arrGoodsSnm = goods.getGoodsSnm1().split(";");
  889. StringBuilder tempGoodsSnm = new StringBuilder();
  890. for (String loopGoodsSnm : arrGoodsSnm) {
  891. if (goodsSnm.toUpperCase().indexOf(loopGoodsSnm.toUpperCase()) <= -1) {
  892. tempGoodsSnm.append(loopGoodsSnm).append(";");
  893. }
  894. }
  895. goods.setGoodsSnm(tempGoodsSnm.toString() + goodsSnm);
  896. } else if (!goodsSnm.equals(goods.getGoodsSnm())) {
  897. goods.setGoodsSnm(goodsSnm);
  898. }
  899. goods.setFormalGb(goods.getFormalGb());
  900. // 브랜드 확인
  901. if (!"G056_N".equals(goods.getGoodsType())) {
  902. if (!goods.getFormalGb().equals(goods.getFormalGbOrg())) {
  903. Brand brand = new Brand();
  904. brand.setBrandCd(goods.getBrandCd());
  905. Collection<Brand> brandList = businessService.getBrandList(brand);
  906. if (brandList != null && !brandList.isEmpty()) {
  907. float pntPrate = 0.0f;
  908. float pntMrate = 0.0f;
  909. for (Brand tmpBrand : brandList) {
  910. if ("G009_10".equals(goods.getFormalGb())) {
  911. pntPrate = tmpBrand.getPntPrate10();
  912. pntMrate = tmpBrand.getPntMrate10();
  913. } else {
  914. pntPrate = tmpBrand.getPntPrate20();
  915. pntMrate = tmpBrand.getPntMrate20();
  916. }
  917. }
  918. goods.setPntPrate(pntPrate); // 포인트적립율(PC)
  919. goods.setPntMrate(pntMrate); // 포인트적립율(MOBILE)
  920. }
  921. }
  922. }
  923. // 기본정보 변경
  924. if ("Y".equals(goods.getChDataYn())) {
  925. goodsDao.createGoodsHst(goods);
  926. goodsDao.updateGoods(goods);
  927. }
  928. // 상품상세정보 변경
  929. if (!"Y".equals(goods.getChkDescKeep())) {
  930. this.saveGoodsDetailDesc(goods);
  931. }
  932. int idx = 1;
  933. // 구성상품 변경
  934. if (!"G056_N".equals(goods.getGoodsType())) {
  935. Collection<GoodsCompose> goodsExtendList = goods.getGoodsComposeListNew();
  936. for (GoodsCompose regGoodsExtend : goodsExtendList) {
  937. regGoodsExtend.setDispOrd(idx);
  938. regGoodsExtend.setRegNo(TsaSession.getInfo().getUserNo());
  939. regGoodsExtend.setUpdNo(TsaSession.getInfo().getUserNo());
  940. goodsDao.saveGoodsCompose(regGoodsExtend); // 구성상품기본 저장
  941. idx++;
  942. }
  943. }
  944. // 옵션/재고 변경
  945. if (goods.getOptCd() != null && goods.getOptCd().length > 0 && "Y".equals(goods.getChStockDataYn())) {
  946. this.saveStock(goods);
  947. }
  948. // 상품 정보고시 변경
  949. this.saveGoodsNotiInfo(goods);
  950. // 상품 구매등급 적용
  951. if (goods.getGoodsOrderGrade() != null && goods.getGoodsOrderGrade().length > 0) {
  952. Goods goodsOrderGrade = new Goods();
  953. goodsOrderGrade.setGoodsCd(goods.getGoodsCd());
  954. goodsOrderGrade.setRegNo(TsaSession.getInfo().getUserNo());
  955. goodsDao.deleteGoodsCustGrade(goodsOrderGrade);
  956. for(String custGrade : goods.getGoodsOrderGrade()) {
  957. goodsOrderGrade.setCustGrade(custGrade);
  958. goodsDao.createGoodsCustGrade(goodsOrderGrade);
  959. }
  960. }else {
  961. Goods goodsOrderGrade = new Goods();
  962. goodsOrderGrade.setGoodsCd(goods.getGoodsCd());
  963. goodsOrderGrade.setRegNo(TsaSession.getInfo().getUserNo());
  964. goodsDao.deleteGoodsCustGrade(goodsOrderGrade);
  965. }
  966. }
  967. /**
  968. * 상품상세정보 변경 - 상품상세
  969. *
  970. * @param goods
  971. * @author eskim
  972. * @since 2020. 10. 27.
  973. */
  974. private void saveGoodsDetailDesc(Goods goods) {
  975. // 상품상세 구분(10:상품타이틀,20:상품타이틀내용,30:상품특징,40:상위컨텐츠,50:하위컨텐츠,60:하위컨텐츠-모바일,70:상위컨텐츠-모바일)
  976. GoodsDesc goodsDesc = new GoodsDesc();
  977. goodsDesc.setGoodsCd(goods.getGoodsCd());
  978. goodsDesc.setRegNo(goods.getRegNo());
  979. goodsDesc.setUpdNo(goods.getUpdNo());
  980. // AS-IS 상세 정보 이력 처리
  981. goodsDao.createGoodsDetailDescHst(goodsDesc);
  982. // 상세 타이틀
  983. goodsDesc.setDescGb("10");
  984. goodsDesc.setGoodsDesc(goods.getGoodsTitlesDesc());
  985. this.saveGoodsDesc(goodsDesc);
  986. // 상세 내용
  987. goodsDesc.setDescGb("20");
  988. goodsDesc.setGoodsDesc(goods.getGoodsContentsDesc());
  989. this.saveGoodsDesc(goodsDesc);
  990. // 상세 특징
  991. goodsDesc.setDescGb("30");
  992. goodsDesc.setGoodsDesc(goods.getGoodsCharacterDesc());
  993. this.saveGoodsDesc(goodsDesc);
  994. // PC 상단
  995. goodsDesc.setDescGb("40");
  996. goodsDesc.setGoodsDesc(goods.getGoodsPcTopDesc());
  997. this.saveGoodsDesc(goodsDesc);
  998. // PC 하단
  999. goodsDesc.setDescGb("50");
  1000. goodsDesc.setGoodsDesc(goods.getGoodsPcDownDesc());
  1001. this.saveGoodsDesc(goodsDesc);
  1002. // MO 상단
  1003. goodsDesc.setDescGb("60");
  1004. goodsDesc.setGoodsDesc(goods.getGoodsMobileTopDesc());
  1005. this.saveGoodsDesc(goodsDesc);
  1006. // MO 하단
  1007. goodsDesc.setDescGb("70");
  1008. goodsDesc.setGoodsDesc(goods.getGoodsMobileDownDesc());
  1009. this.saveGoodsDesc(goodsDesc);
  1010. }
  1011. /**
  1012. * 상품 상세 저장
  1013. *
  1014. * @param goodsDesc
  1015. * @return
  1016. * @author eskim
  1017. * @since 2020. 10. 27
  1018. */
  1019. private void saveGoodsDesc(GoodsDesc goodsDesc) {
  1020. goodsDao.deleteGoodsDesc(goodsDesc);
  1021. String[] arrProdHtml = null;
  1022. arrProdHtml = makeArrayToString(goodsDesc.getGoodsDesc(), 3900);
  1023. if (arrProdHtml.length > 0) {
  1024. for (int i = 0; i < arrProdHtml.length; i++) {
  1025. if (!arrProdHtml[i].isEmpty()) {
  1026. goodsDesc.setSeq(i + 1);
  1027. goodsDesc.setGoodsDesc(arrProdHtml[i]);
  1028. goodsDao.createGoodsDesc(goodsDesc);
  1029. }
  1030. }
  1031. }
  1032. }
  1033. /**
  1034. * String => byte array
  1035. *
  1036. * @param raw
  1037. * @param len
  1038. * @return
  1039. * @author eskim
  1040. * @since 2020. 10. 27
  1041. */
  1042. public static String[] makeArrayToString(String raw, int len) {
  1043. String[] ary = null;
  1044. if (raw == null) {
  1045. return ary;
  1046. }
  1047. try {
  1048. // raw 의 byte
  1049. byte[] rawBytes = raw.getBytes("UTF-8"); // MS949
  1050. int rawLength = rawBytes.length;
  1051. if (rawLength > len) {
  1052. int aryLength = (rawLength / len) + (rawLength % len != 0 ? 1 : 0);
  1053. ary = new String[aryLength];
  1054. int endCharIndex = 0; // 문자열이 끝나는 위치
  1055. String tmp;
  1056. for (int i = 0; i < aryLength; i++) {
  1057. if (i == (aryLength - 1)) {
  1058. tmp = raw.substring(endCharIndex);
  1059. } else {
  1060. int useByteLength = 0;
  1061. int rSize = 0;
  1062. for (; endCharIndex < raw.length(); endCharIndex++) {
  1063. if (raw.charAt(endCharIndex) > 0x007F) {
  1064. useByteLength += 3;
  1065. } else {
  1066. useByteLength++;
  1067. }
  1068. if (useByteLength > len) {
  1069. break;
  1070. }
  1071. rSize++;
  1072. }
  1073. tmp = raw.substring((endCharIndex - rSize), endCharIndex);
  1074. }
  1075. ary[i] = tmp;
  1076. }
  1077. } else {
  1078. ary = new String[] {raw};
  1079. }
  1080. } catch (java.io.UnsupportedEncodingException e) {
  1081. }
  1082. return ary;
  1083. }
  1084. /**
  1085. * 옵션/재고 변경 - 상품상세
  1086. *
  1087. * @param goods
  1088. * @param index
  1089. * @author eskim
  1090. * @since 2020. 10. 27
  1091. */
  1092. private void saveStock(Goods goods) {
  1093. int index = 0;
  1094. Option stock = new Option();
  1095. stock.setGoodsCd(goods.getGoodsCd());
  1096. stock.setUpdNo(goods.getUpdNo());
  1097. stock.setRegNo(goods.getRegNo());
  1098. goodsDao.createStockHst(stock);
  1099. log.info("saveStock goods={}", goods);
  1100. for (String optCd : goods.getOptCd()) {
  1101. log.info("saveStock index={}", index);
  1102. log.info("saveStock optCd={}", optCd);
  1103. Option goodsStock = new Option();
  1104. goodsStock.setGoodsCd(goods.getCompsGoodsCd()[index]); // 구성상품 코드
  1105. goodsStock.setOptCd(optCd);
  1106. goodsStock.setOptCd1(goods.getOptCd1()[index]);
  1107. goodsStock.setOptCd2(goods.getOptCd2()[index]);
  1108. goodsStock.setBaseStockQty(Integer.parseInt(goods.getBaseStockQty()[index]));
  1109. goodsStock.setSoldoutYn(goods.getSoldoutYn()[index]);
  1110. goodsStock.setDispOrd(Integer.parseInt(goods.getDispOrd()[index]));
  1111. goodsStock.setDispYn(goods.getDispYn()[index]);
  1112. goodsStock.setRegNo(goods.getRegNo());
  1113. goodsStock.setUpdNo(goods.getUpdNo());
  1114. if ("N".equals(goods.getSelfGoodsYn())) {
  1115. goodsStock.setSelfGoodsYn(goods.getSelfGoodsYn());
  1116. goodsStock.setCurrStockQty(Integer.parseInt(goods.getEditCurrStockQty()[index]));
  1117. }
  1118. goodsDao.saveStock(goodsStock);
  1119. index++;
  1120. }
  1121. }
  1122. /**
  1123. * 상품 사이즈 옵션정보 이력 생성
  1124. *
  1125. * @param goods
  1126. * @author eskim
  1127. * @since 2020. 11. 17
  1128. */
  1129. @Transactional("shopTxnManager")
  1130. public void createStockHst(Option option) {
  1131. goodsDao.createStockHst(option);
  1132. }
  1133. /**
  1134. * 상품 정보고시 변경 - 상품상세
  1135. *
  1136. * @param goods
  1137. * @author eskim
  1138. * @since 2020. 10. 27
  1139. */
  1140. private void saveGoodsNotiInfo(Goods goods) {
  1141. int index;
  1142. if (goods.getNotiListNew() != null && !goods.getNotiListNew().isEmpty()) {
  1143. index = 0;
  1144. for (GoodsNotiInfo goodsNotiInfo : goods.getNotiListNew()) {
  1145. if (index == 0) {
  1146. goodsDao.deleteGoodsNotiInfo(goods);
  1147. }
  1148. goodsNotiInfo.setNiContent(GagaStringUtil.replace(GagaStringUtil.replace(goodsNotiInfo.getNiContent(), "&lt;", "<"), "&gt;", ">"));
  1149. goodsNotiInfo.setRegNo(goods.getRegNo());
  1150. goodsNotiInfo.setUpdNo(goods.getUpdNo());
  1151. goodsDao.saveGoodsNotiInfo(goodsNotiInfo);
  1152. index++;
  1153. }
  1154. }
  1155. }
  1156. /**
  1157. * 딜상품 저장
  1158. *
  1159. * @param goods
  1160. * @return
  1161. * @author eskim
  1162. * @since 2020. 10. 30
  1163. */
  1164. @Transactional("shopTxnManager")
  1165. public void saveGoodsDeal(Goods goods) {
  1166. Goods regGoods = new Goods();
  1167. // <,> replace 처리
  1168. regGoods.setRegNo(TsaSession.getInfo().getUserNo());
  1169. regGoods.setUpdNo(TsaSession.getInfo().getUserNo());
  1170. String goodsCd = this.getGoodsCodeSeq("D", "D");
  1171. regGoods.setGoodsCd(goodsCd);
  1172. regGoods.setSupplyGoodsCd(goodsCd);
  1173. regGoods.setGoodsType("G056_D");
  1174. regGoods.setSupplyCompCd(goods.getSupplyCompCd());
  1175. regGoods.setBrandCd(goods.getBrandCd());
  1176. regGoods.setItemkindCd(goods.getItemkindCd());
  1177. regGoods.setGoodsNm(GagaStringUtil.replace(GagaStringUtil.replace(goods.getGoodsNm(), "&lt;", "<"), "&gt;", ">"));
  1178. regGoods.setStyleYear(goods.getStyleYear());
  1179. regGoods.setSeasonCd(goods.getSeasonCd());
  1180. regGoods.setSexGb(goods.getSexGb());
  1181. regGoods.setMainColorCd("00");
  1182. regGoods.setOriginCd(goods.getOriginCd());
  1183. regGoods.setMakeYmd(goods.getMakeYmd());
  1184. regGoods.setSelfMallYn(goods.getSelfMallYn());
  1185. regGoods.setGoodsStat("G008_20"); // 정보부족
  1186. regGoods.setFormalGb("G009_10"); // 정상 기본값 처리
  1187. regGoods.setGoodsGb("G073_11"); // 자사상품은 신규
  1188. regGoods.setDistributionGb("G065_12"); // 유통구분
  1189. regGoods.setTaxGb("10"); // 과세구분
  1190. regGoods.setGoodsNum(goodsCd);
  1191. regGoods.setListPrice(goods.getCurrPrice());
  1192. regGoods.setCurrPrice(goods.getCurrPrice());
  1193. regGoods.setDcRate((int)(this.getDcRate(goods.getCurrPrice(), goods.getCurrPrice())));
  1194. Collection<GoodsCompose> goodsComposeList = null;
  1195. try {
  1196. goodsComposeList = mapper.readValue(goods.getGoodsComposeList(), new TypeReference<Collection<GoodsCompose>>() {
  1197. });
  1198. } catch (Exception e) {
  1199. e.printStackTrace();
  1200. throw new IllegalStateException(message.getMessage("딜상품 저장 중 오류로 인해 저장되지 않았습니다."));
  1201. }
  1202. for (GoodsCompose goodsCompose : goodsComposeList) {
  1203. goodsCompose.setGoodsCd(regGoods.getGoodsCd());
  1204. goodsCompose.setGoodsType(regGoods.getGoodsType());
  1205. goodsCompose.setRegNo(TsaSession.getInfo().getUserNo());
  1206. goodsCompose.setUpdNo(TsaSession.getInfo().getUserNo());
  1207. Goods extendGoods = new Goods();
  1208. extendGoods.setGoodsCd(goodsCompose.getCompsGoodsCd());
  1209. extendGoods = goodsDao.getGoods(extendGoods);
  1210. if (StringUtils.isEmpty(extendGoods.getBrandCd())) {
  1211. throw new IllegalStateException(message.getMessage("구성상품 중 " + goodsCompose.getCompsGoodsCd() + " 상품 정보를 확인해 주세요."));
  1212. }
  1213. if ("Y".equals(goodsCompose.getBaseYn())) {
  1214. regGoods.setBrandCd(extendGoods.getBrandCd());
  1215. regGoods.setItemkindCd(extendGoods.getItemkindCd());
  1216. regGoods.setSupplyCompCd(extendGoods.getSupplyCompCd());
  1217. regGoods.setFormalGb(extendGoods.getFormalGb());
  1218. }
  1219. }
  1220. this.createGoodsExtend(regGoods, goodsComposeList); // 딜상품 관련 정보 저장
  1221. }
  1222. /**
  1223. * 세트상품 저장
  1224. *
  1225. * @param goods
  1226. * @return
  1227. * @author eskim
  1228. * @since 2020. 11. 04
  1229. */
  1230. @Transactional("shopTxnManager")
  1231. public void saveGoodsSet(Goods goods) {
  1232. Goods regGoods = new Goods();
  1233. // <,> replace 처리
  1234. regGoods.setRegNo(TsaSession.getInfo().getUserNo());
  1235. regGoods.setUpdNo(TsaSession.getInfo().getUserNo());
  1236. String goodsCd = this.getGoodsCodeSeq("S", "S");
  1237. regGoods.setGoodsCd(goodsCd);
  1238. regGoods.setSupplyGoodsCd(goodsCd);
  1239. regGoods.setGoodsType("G056_S");
  1240. regGoods.setSupplyCompCd(goods.getSupplyCompCd());
  1241. regGoods.setBrandCd(goods.getBrandCd());
  1242. regGoods.setItemkindCd(goods.getItemkindCd());
  1243. regGoods.setGoodsNm(GagaStringUtil.replace(GagaStringUtil.replace(goods.getGoodsNm(), "&lt;", "<"), "&gt;", ">"));
  1244. regGoods.setStyleYear(goods.getStyleYear());
  1245. regGoods.setSeasonCd(goods.getSeasonCd());
  1246. regGoods.setSexGb(goods.getSexGb());
  1247. regGoods.setMainColorCd("00");
  1248. regGoods.setOriginCd(goods.getOriginCd());
  1249. regGoods.setMakeYmd(goods.getMakeYmd());
  1250. regGoods.setSelfMallYn(goods.getSelfMallYn());
  1251. regGoods.setGoodsStat("G008_20"); // 정보부족
  1252. regGoods.setFormalGb("G009_10"); // 정상 기본값 처리
  1253. regGoods.setGoodsGb("G073_11"); // 자사상품은 신규
  1254. regGoods.setDistributionGb("G065_12"); // 유통구분
  1255. regGoods.setTaxGb("10"); // 과세구분
  1256. regGoods.setGoodsNum(goodsCd);
  1257. Collection<GoodsCompose> goodsComposeList = null;
  1258. try {
  1259. goodsComposeList = mapper.readValue(goods.getGoodsComposeList(), new TypeReference<Collection<GoodsCompose>>() {
  1260. });
  1261. } catch (Exception e) {
  1262. throw new IllegalStateException(message.getMessage("세트상품 저장 중 오류로 인해 저장되지 않았습니다."));
  1263. }
  1264. int listPriceSum = 0;
  1265. int currPriceSum = 0;
  1266. for (GoodsCompose goodsCompose : goodsComposeList) {
  1267. goodsCompose.setGoodsCd(regGoods.getGoodsCd());
  1268. goodsCompose.setGoodsType(regGoods.getGoodsType());
  1269. goodsCompose.setRegNo(TsaSession.getInfo().getUserNo());
  1270. goodsCompose.setUpdNo(TsaSession.getInfo().getUserNo());
  1271. Goods extendGoods = new Goods();
  1272. extendGoods.setGoodsCd(goodsCompose.getCompsGoodsCd());
  1273. extendGoods = goodsDao.getGoods(extendGoods);
  1274. if (StringUtils.isEmpty(extendGoods.getBrandCd())) {
  1275. throw new IllegalStateException(message.getMessage("구성상품 중 " + goodsCompose.getCompsGoodsCd() + " 상품 정보를 확인해 주세요."));
  1276. }
  1277. listPriceSum += extendGoods.getListPrice() * goodsCompose.getQty() ;
  1278. currPriceSum += goodsCompose.getCompsCurrPrice(); // 입력값
  1279. if ("Y".equals(goodsCompose.getBaseYn())) {
  1280. regGoods.setBrandCd(extendGoods.getBrandCd());
  1281. regGoods.setItemkindCd(extendGoods.getItemkindCd());
  1282. regGoods.setGoodsNum(extendGoods.getGoodsNum());
  1283. regGoods.setSupplyCompCd(extendGoods.getSupplyCompCd());
  1284. regGoods.setFormalGb(extendGoods.getFormalGb());
  1285. }
  1286. }
  1287. regGoods.setListPrice(listPriceSum);
  1288. regGoods.setCurrPrice(currPriceSum);
  1289. regGoods.setCostPrice(0); // 원가 0원처리
  1290. regGoods.setDcRate((int)(this.getDcRate(listPriceSum, currPriceSum)));
  1291. this.createGoodsExtend(regGoods, goodsComposeList); // 세트상품 관련 정보 저장
  1292. }
  1293. /**
  1294. * 세트/딜 상품 관련 저장
  1295. *
  1296. * @param goods
  1297. * @return
  1298. * @author eskim
  1299. * @since 2020. 10. 30
  1300. */
  1301. private void createGoodsExtend(Goods regGoods, Collection<GoodsCompose> goodsComposeList) {
  1302. // 브랜드 확인
  1303. Brand brand = new Brand();
  1304. brand.setBrandCd(regGoods.getBrandCd());
  1305. brand.setSupplyCompCd(regGoods.getSupplyCompCd());
  1306. Collection<Brand> brandList = businessService.getBrandList(brand);
  1307. if (brandList == null || brandList.isEmpty()) {
  1308. throw new IllegalStateException(message.getMessage("구성상품 중 기준 상품의 브랜드를 확인해 주세요."));
  1309. }
  1310. float pntPrate = 0.0f;
  1311. float pntMrate = 0.0f;
  1312. float sellFeeRate = 0.0f;
  1313. String delvFeeCd = "";
  1314. for (Brand tmpBrand : brandList) {
  1315. if ("10".equals(regGoods.getFormalGb())) {
  1316. pntPrate = tmpBrand.getPntPrate10();
  1317. pntMrate = tmpBrand.getPntMrate10();
  1318. } else {
  1319. pntPrate = tmpBrand.getPntPrate20();
  1320. pntMrate = tmpBrand.getPntMrate20();
  1321. }
  1322. sellFeeRate = tmpBrand.getSellFeeRate();
  1323. delvFeeCd = tmpBrand.getDelvFeeCd();
  1324. }
  1325. regGoods.setDelvFeeCd(delvFeeCd);// 배송비전책코드
  1326. regGoods.setPntPrate(pntPrate); // 포인트적립율(PC)
  1327. regGoods.setPntMrate(pntMrate); // 포인트적립율(MOBILE)
  1328. regGoods.setSellFeeRate(sellFeeRate); // 판매수수료율
  1329. regGoods.setSelfGoodsYn("Y");
  1330. // 스타일 연도
  1331. regGoods.setStyleYear(regGoods.getStyleYear());
  1332. goodsDao.createGoods(regGoods); // 상품기본 저장
  1333. goodsDao.createGoodsSmmary(regGoods); // 상품통계 생성
  1334. StringBuilder goodsDescSb = new StringBuilder(); // 상품상세
  1335. int dispOrd = 1;
  1336. for (GoodsCompose regGoodsExtend : goodsComposeList) {
  1337. regGoodsExtend.setDispOrd(dispOrd);
  1338. goodsDao.saveGoodsCompose(regGoodsExtend); // 구성상품기본 저장
  1339. dispOrd++;
  1340. }
  1341. // 사용자 검색어를 검색어에 적용
  1342. String goodsSnm = goodsDao.getGoodsSnm(regGoods.getGoodsCd());
  1343. regGoods.setGoodsSnm(goodsSnm);
  1344. goodsDao.updateGoodsSnm(regGoods);
  1345. // 카테고리 전시
  1346. // 추후 작업 해야함 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  1347. //goodsDao.createCategoryGoods(regGoods);
  1348. }
  1349. // /**
  1350. // * 품 이미지 경로생성
  1351. // *
  1352. // * @param goodsCd
  1353. // * @param brandCd
  1354. // * @return String
  1355. // * @author eskim
  1356. // * @since 2020. 10. 30
  1357. // */
  1358. // private String getGoodsImgPath(String goodsCd, String brandCd) {
  1359. // return "/" + goodsCd.substring(0, 1) + "/" + goodsCd.substring(0, 3) + "/" + goodsCd + "/1000/" + goodsCd + "_";
  1360. // }
  1361. /**
  1362. * 상품 코드 생성
  1363. *
  1364. * @param goodsType - 상품타입
  1365. * @param goodsCdAfter - 상품시퀀스 앞에 붙는명
  1366. * @return
  1367. * @author eskim
  1368. * @since 2020. 10. 30
  1369. */
  1370. public String getGoodsCodeSeq(String goodsType, String goodsCdAfter) {
  1371. //상품코드 12자리
  1372. String goodsCd = "";
  1373. Goods goods = new Goods();
  1374. goodsDao.createGoodsSequence(goods);
  1375. String goodsSeq = GagaStringUtil.getLPadding(Integer.toString(goods.getGoodsSq()), 8, "0");
  1376. if ("S".equals(goodsType) || "D".equals(goodsType)) {
  1377. goodsCd = SELF_GOOODS_AFTER + goodsCdAfter + goodsSeq;
  1378. } else {
  1379. goodsCd = goodsCdAfter + goodsSeq; // 입점 : 브랜드코드
  1380. }
  1381. return goodsCd;
  1382. }
  1383. /**
  1384. * 상품 타이틀 관리 목록 건수
  1385. *
  1386. * @param goodsSearch
  1387. * @return
  1388. * @author eskim
  1389. * @since 2020. 11 .02
  1390. */
  1391. public int getGoodsTitleReserveCount(GoodsSearch goodsSearch) {
  1392. return goodsDao.getGoodsTitleReserveCount(goodsSearch);
  1393. }
  1394. /**
  1395. * 상품 타이틀 관리 목록
  1396. *
  1397. * @param goodsSearch
  1398. * @return
  1399. * @author eskim
  1400. * @since 2020. 11 .02
  1401. */
  1402. public Collection<GoodsTnmRes> getGoodsTitleReserveList(GoodsSearch goodsSearch) {
  1403. return goodsDao.getGoodsTitleReserveList(goodsSearch);
  1404. }
  1405. /**
  1406. * 상품 타이틀 예약 등록
  1407. *
  1408. * @param goodsTnmRes
  1409. * @author eskim
  1410. * @since 2020. 11 .02
  1411. */
  1412. @Transactional("shopTxnManager")
  1413. public void saveGoodsRsvtTnm(GoodsTnmRes goodsTnmRes) {
  1414. if (goodsTnmRes.getArrGoodsCd().length <= 0) {
  1415. throw new IllegalStateException(message.getMessage("FAIL_1001"));
  1416. }
  1417. goodsTnmRes.setGoodsTnm(GagaStringUtil.replace(GagaStringUtil.replace(goodsTnmRes.getGoodsTnm(), "&lt;", "<"), "&gt;", ">"));
  1418. for (String goodsCd : goodsTnmRes.getArrGoodsCd()) {
  1419. goodsTnmRes.setGoodsCd(goodsCd);
  1420. goodsTnmRes.setRegNo(TsaSession.getInfo().getUserNo());
  1421. goodsTnmRes.setUpdNo(TsaSession.getInfo().getUserNo());
  1422. if (goodsDao.getGoodsTnmDupChkCount(goodsTnmRes) > 0) {
  1423. throw new IllegalStateException("이미 등록된 상품 타이틀예약이 등록하려는 예약기간내에 존재합니다. \n(상품코드 : " + goodsCd + ")");
  1424. }
  1425. goodsDao.createGoodTnmRes(goodsTnmRes);
  1426. // 현재일자가 예약기간에 포함되어 있으면 바로 적용한다.
  1427. String toDaytime = GagaDateUtil.getTodayDateTime();
  1428. if (Long.parseLong(toDaytime) >= Long.parseLong(goodsTnmRes.getApplyStdt()) && Long.parseLong(toDaytime) <= Long.parseLong(goodsTnmRes.getApplyEddt())) {
  1429. // 이력생성 및 상품타이틀 수정
  1430. Goods goods = new Goods();
  1431. goods.setGoodsCd(goodsCd);
  1432. goods.setGoodsTnm(goodsTnmRes.getGoodsTnm());
  1433. goods.setRegNo(TsaSession.getInfo().getUserNo());
  1434. goods.setUpdNo(TsaSession.getInfo().getUserNo());
  1435. goodsDao.createGoodsHst(goods);
  1436. goodsDao.updateGoodTnm(goods);
  1437. }
  1438. }
  1439. }
  1440. /**
  1441. * 상품 타이틀 예약 삭제
  1442. *
  1443. * @param goodsTnmRes
  1444. * @author eskim
  1445. * @since 2020. 11 .02
  1446. */
  1447. @Transactional("shopTxnManager")
  1448. public void deleteGoodsRsvtTnm(GoodsTnmRes goodsTnmRes) {
  1449. if (goodsTnmRes.getArrGoodsCd().length <= 0) {
  1450. throw new IllegalStateException(message.getMessage("FAIL_1001"));
  1451. }
  1452. int idx = 0;
  1453. for (String goodsCd : goodsTnmRes.getArrGoodsCd()) {
  1454. // 상품 타이틀 예약 삭제
  1455. goodsTnmRes.setGoodsTnmResSq(goodsTnmRes.getArrGoodsTnmResSq()[idx]);
  1456. goodsDao.deleteGoodTnmRes(goodsTnmRes);
  1457. // 상품 타이틀 예약건 초기화
  1458. Goods goods = new Goods();
  1459. goods.setGoodsCd(goodsCd);
  1460. goods = goodsDao.getGoodTnmInit(goods);
  1461. goods.setRegNo(TsaSession.getInfo().getUserNo());
  1462. goods.setUpdNo(TsaSession.getInfo().getUserNo());
  1463. if (!StringUtils.isEmpty(goods.getGoodsTnm()) && !goods.getGoodsTnm().equals(goods.getGoodTnmInit())) {
  1464. // 상품이력 먼저 쌓기
  1465. goodsDao.createGoodsHst(goods);
  1466. // 정보수정
  1467. goods.setGoodsTnm(goods.getGoodTnmInit());
  1468. goodsDao.updateGoodTnm(goods);
  1469. }
  1470. idx++;
  1471. }
  1472. }
  1473. /**
  1474. * 네이버 EP 제외 상품 목록 건수
  1475. *
  1476. * @param goodsSearch
  1477. * @return int
  1478. * @author eskim
  1479. * @since 2020. 11. 03
  1480. */
  1481. public int getGoodsEpSkipCount(GoodsSearch goodsSearch) {
  1482. return goodsDao.getGoodsEpSkipCount(goodsSearch);
  1483. }
  1484. /**
  1485. * 네이버 EP 제외 상품 목록
  1486. *
  1487. * @param goodsSearch
  1488. * @return Collection<TsaGoodsEpSkip>
  1489. * @author eskim
  1490. * @since 2020. 11. 03
  1491. */
  1492. public Collection<GoodsEpSkip> getGoodsEpSkipList(GoodsSearch goodsSearch) {
  1493. return goodsDao.getGoodsEpSkipList(goodsSearch);
  1494. }
  1495. /**
  1496. * 네이버 EP 제외 상품 예약 등록
  1497. *
  1498. * @param goodsEpSkip
  1499. * @return void
  1500. * @author eskim
  1501. * @since 2020. 11. 03
  1502. */
  1503. @Transactional("shopTxnManager")
  1504. public void saveGoodsRsvtEpSkip(GoodsEpSkip goodsEpSkip) {
  1505. if (goodsEpSkip.getArrGoodsCd().length <= 0) {
  1506. throw new IllegalStateException(message.getMessage("FAIL_1001"));
  1507. }
  1508. for (String goodsCd : goodsEpSkip.getArrGoodsCd()) {
  1509. goodsEpSkip.setGoodsCd(goodsCd);
  1510. goodsEpSkip.setRegNo(TsaSession.getInfo().getUserNo());
  1511. goodsEpSkip.setUpdNo(TsaSession.getInfo().getUserNo());
  1512. if (goodsDao.getGoodsEpSkipDupChkCount(goodsEpSkip) > 0) {
  1513. throw new IllegalStateException("비노출예약이 중복된 상품이 존재합니다.<br/>(상품코드 : " + goodsCd + ")");
  1514. }
  1515. goodsDao.createGoodEpSkip(goodsEpSkip);
  1516. }
  1517. }
  1518. /**
  1519. * 네이버 EP 제외 상품 예약 삭제
  1520. *
  1521. * @param goodsEpSkip
  1522. * @return void
  1523. * @author eskim
  1524. * @since 2020. 11. 03
  1525. */
  1526. @Transactional("shopTxnManager")
  1527. public void deleteGoodsEpSkip(GoodsEpSkip goodsEpSkip) {
  1528. if (goodsEpSkip.getArrGoodsCd().length <= 0) {
  1529. throw new IllegalStateException(message.getMessage("FAIL_1001"));
  1530. }
  1531. int idx = 0;
  1532. for (String goodsCd : goodsEpSkip.getArrGoodsCd()) {
  1533. goodsEpSkip.setGoodsEpSkipSq(goodsEpSkip.getArrGoodsEpSkipSq()[idx]);
  1534. goodsDao.deleteGoodEpSkip(goodsEpSkip);
  1535. idx++;
  1536. }
  1537. }
  1538. /**
  1539. * 상품예약판매 목록 건수
  1540. *
  1541. * @param goodsSearch
  1542. * @return Integer
  1543. * @author eskim
  1544. * @since 2020. 11. 12
  1545. */
  1546. public int getGoodsResSellCount(GoodsSearch goodsSearch) {
  1547. return goodsDao.getGoodsResSellCount(goodsSearch);
  1548. }
  1549. /**
  1550. * 상품예약판매 목록
  1551. *
  1552. * @param goodsSearch
  1553. * @return Collection<TsaGoodsResSell>
  1554. * @author eskim
  1555. * @since 2020. 11. 12
  1556. */
  1557. public Collection<GoodsResSell> getGoodsResSellList(GoodsSearch goodsSearch) {
  1558. return goodsDao.getGoodsResSellList(goodsSearch);
  1559. }
  1560. /**
  1561. * 상품예약판매 등록
  1562. *
  1563. * @param goodsResSell
  1564. * @return void
  1565. * @author eskim
  1566. * @since 2020. 11. 12
  1567. */
  1568. @Transactional("shopTxnManager")
  1569. public void saveGoodsResSell(GoodsResSell goodsResSell) {
  1570. if (goodsResSell.getArrGoodsCd().length <= 0) {
  1571. throw new IllegalStateException(message.getMessage("FAIL_1001"));
  1572. }
  1573. for (String goodsCd : goodsResSell.getArrGoodsCd()) {
  1574. goodsResSell.setGoodsCd(goodsCd);
  1575. goodsResSell.setRegNo(TsaSession.getInfo().getUserNo());
  1576. goodsResSell.setUpdNo(TsaSession.getInfo().getUserNo());
  1577. if(goodsDao.getGoodsResSellDupChkCount(goodsResSell) > 0 ) {
  1578. throw new IllegalStateException("이미 등록된 상품예약판매가 존재합니다. \n(상품코드 : " + goodsCd + ")");
  1579. }
  1580. goodsDao.createGoodResSell(goodsResSell);
  1581. Goods goods = new Goods();
  1582. goods.setRegNo(TsaSession.getInfo().getUserNo());
  1583. goods.setUpdNo(TsaSession.getInfo().getUserNo());
  1584. goods.setGoodsCd(goodsResSell.getGoodsCd());
  1585. // 재고연동 비활성화
  1586. goodsDao.createGoodsHst(goods);
  1587. goodsDao.updateGoodsErpStockLinkYn(goods);
  1588. }
  1589. }
  1590. /**
  1591. * 상품예약판매 삭제
  1592. *
  1593. * @param goodsResSell
  1594. * @return void
  1595. * @author eskim
  1596. * @since 2020. 11. 12
  1597. */
  1598. @Transactional("shopTxnManager")
  1599. public void deleteGoodsResSell(GoodsResSell goodsResSell) {
  1600. if (goodsResSell.getArrGoodsCd().length <= 0) {
  1601. throw new IllegalStateException(message.getMessage("FAIL_1001"));
  1602. }
  1603. int idx = 0;
  1604. for (String goodsCd : goodsResSell.getArrGoodsCd()) {
  1605. goodsResSell.setGoodsResSellSq(goodsResSell.getArrGoodsResSellSq()[idx]);
  1606. goodsDao.deleteGoodResSell(goodsResSell);
  1607. idx++;
  1608. }
  1609. }
  1610. /**
  1611. * 상품 상세공지 목록
  1612. *
  1613. * @param goodsSearch
  1614. * @return
  1615. * @author eskim
  1616. * @since 2020. 11. 05
  1617. */
  1618. public Collection<Notice> getNoticeList(GoodsSearch goodsSearch) {
  1619. return goodsDao.getNoticeList(goodsSearch);
  1620. }
  1621. /**
  1622. * 상품 상세공지 상품 목록
  1623. *
  1624. * @param notice
  1625. * @return
  1626. * @author eskim
  1627. * @since 2020. 11. 06
  1628. */
  1629. public Collection<NoticeGoods> getNoticeGoodsList(Notice notice) {
  1630. return goodsDao.getNoticeGoodsList(notice);
  1631. }
  1632. /**
  1633. * 공지사항 저장
  1634. * @param notice - 공지사항 정보
  1635. * @return
  1636. * @author eskim
  1637. * @since 2020. 11. 05
  1638. */
  1639. @Transactional("shopTxnManager")
  1640. public void saveNotice(Notice notice) {
  1641. notice.setRegNo(TsaSession.getInfo().getUserNo());
  1642. notice.setUpdNo(TsaSession.getInfo().getUserNo());
  1643. // 신규 일때
  1644. if (notice.getNoticeSq() == null) {
  1645. // 공지사항 저장
  1646. noticeService.createNotice(notice);
  1647. // 등록된 사용자번호 값 가져오기
  1648. Integer noticeSq = notice.getNoticeSq();
  1649. notice.setNoticeSq(noticeSq);
  1650. } else {
  1651. // 공지사항 수정
  1652. noticeService.updateNotice(notice);
  1653. }
  1654. if (!StringUtils.isEmpty(notice.getGoodsList())) {
  1655. Collection<NoticeGoods> noticeGoodsList = null;
  1656. try {
  1657. noticeGoodsList = mapper.readValue(notice.getGoodsList(), new TypeReference<Collection<NoticeGoods>>() {
  1658. });
  1659. } catch (Exception e) {
  1660. e.printStackTrace();
  1661. throw new IllegalStateException(message.getMessage("상품상세공지 저장 중 오류로 인해 저장되지 않았습니다."));
  1662. }
  1663. log.info("noticeGoodsList: {}", noticeGoodsList);
  1664. for (NoticeGoods noticeGoods : noticeGoodsList) {
  1665. noticeGoods.setNoticeSq(notice.getNoticeSq());
  1666. noticeGoods.setRegNo(TsaSession.getInfo().getUserNo());
  1667. noticeGoods.setUpdNo(TsaSession.getInfo().getUserNo());
  1668. goodsDao.saveNoticeGoods(noticeGoods);
  1669. }
  1670. }
  1671. }
  1672. /**
  1673. * 공지사항 상품 삭제
  1674. * @param noticeGoods
  1675. * @return
  1676. * @author eskim
  1677. * @since 2020. 11. 06
  1678. */
  1679. @Transactional("shopTxnManager")
  1680. public void deleteNoticeGoods(NoticeGoods noticeGoods) {
  1681. if (noticeGoods == null || (noticeGoods.getArrGoodsCd() == null && noticeGoods.getArrGoodsCd().length <= 0)) {
  1682. throw new IllegalStateException(message.getMessage("FAIL_1001"));
  1683. }
  1684. if (noticeGoods.getArrGoodsCd().length > 0) {
  1685. for (String goodsCd : noticeGoods.getArrGoodsCd()) {
  1686. noticeGoods.setGoodsCd(goodsCd);
  1687. noticeGoods.setRegNo(TsaSession.getInfo().getUserNo());
  1688. noticeGoods.setUpdNo(TsaSession.getInfo().getUserNo());
  1689. goodsDao.deleteNoticeGoods(noticeGoods);
  1690. }
  1691. }
  1692. }
  1693. /**
  1694. * 상품 가격예약 목록 건수
  1695. *
  1696. * @param goodsSearch
  1697. * @return Integer
  1698. * @author eskim
  1699. * @since 2020. 11. 13
  1700. */
  1701. public int getGoodsPriceResCount(GoodsSearch goodsSearch) {
  1702. return goodsDao.getGoodsPriceResCount(goodsSearch);
  1703. }
  1704. /**
  1705. * 상품 가격예약 목록
  1706. *
  1707. * @param goodsSearch
  1708. * @return Collection<TsaGoodsResSell>
  1709. * @author eskim
  1710. * @since 2020. 11. 13
  1711. */
  1712. public Collection<GoodsPriceRes> getGoodsPriceResList(GoodsSearch goodsSearch) {
  1713. return goodsDao.getGoodsPriceResList(goodsSearch);
  1714. }
  1715. /**
  1716. * 상품 가격예약 등록
  1717. *
  1718. * @param goodsPriceRes
  1719. * @return void
  1720. * @author eskim
  1721. * @since 2020. 11. 13
  1722. */
  1723. @Transactional("shopTxnManager")
  1724. public void createGoodPriceRes(GoodsPriceRes goodsPriceRes) {
  1725. if (goodsPriceRes.getArrGoodsCd().length <= 0) {
  1726. throw new IllegalStateException(message.getMessage("FAIL_1001"));
  1727. }
  1728. int idx = 0;
  1729. for (String goodsCd : goodsPriceRes.getArrGoodsCd()) {
  1730. goodsPriceRes.setGoodsCd(goodsCd);
  1731. goodsPriceRes.setEndGoodsPrice(goodsPriceRes.getArrEndGoodsPrice()[idx]);
  1732. goodsPriceRes.setRegNo(TsaSession.getInfo().getUserNo());
  1733. goodsPriceRes.setUpdNo(TsaSession.getInfo().getUserNo());
  1734. if(goodsDao.getGoodsPriceResDupChkCount(goodsPriceRes) > 0 ) {
  1735. throw new IllegalStateException("이미 등록된 상품 가격예약이 존재합니다. \n(상품코드 : " + goodsCd + ")");
  1736. }
  1737. goodsDao.createGoodPriceRes(goodsPriceRes);
  1738. Goods goods = new Goods();
  1739. goods.setRegNo(TsaSession.getInfo().getUserNo());
  1740. goods.setUpdNo(TsaSession.getInfo().getUserNo());
  1741. goods.setGoodsCd(goodsPriceRes.getGoodsCd());
  1742. idx++;
  1743. }
  1744. }
  1745. /**
  1746. * 상품 가격예약 삭제
  1747. *
  1748. * @param goodsPriceRes
  1749. * @return void
  1750. * @author eskim
  1751. * @since 2020. 11. 13
  1752. */
  1753. @Transactional("shopTxnManager")
  1754. public void deleteGoodsPriceRes(GoodsPriceRes goodsPriceRes) {
  1755. if (goodsPriceRes.getArrGoodsCd().length <= 0) {
  1756. throw new IllegalStateException(message.getMessage("FAIL_1001"));
  1757. }
  1758. int idx = 0;
  1759. for (String goodsCd : goodsPriceRes.getArrGoodsCd()) {
  1760. goodsPriceRes.setGoodsPriceResSq(goodsPriceRes.getArrGoodsPriceResSq()[idx]);
  1761. goodsDao.deleteGoodPriceRes(goodsPriceRes);
  1762. idx++;
  1763. }
  1764. }
  1765. /**
  1766. * 상품 가격예약 저장
  1767. *
  1768. * @param goodsPriceList
  1769. * @return
  1770. * @author eskim
  1771. * @since 2020. 11. 16
  1772. */
  1773. @Transactional("shopTxnManager")
  1774. public void saveGoodsPriceExcelupload(Collection<GoodsPriceRes> goodsPriceList, String excelFilename) {
  1775. String targetPath = GagaFileUtil.getConcatenationPath(env.getProperty("upload.excel.target.path"), "excel");
  1776. if (goodsPriceList == null || goodsPriceList.isEmpty()) {
  1777. this.deleteExceluploadFile(targetPath, excelFilename);
  1778. throw new IllegalStateException(message.getMessage("FAIL_1001"));
  1779. }
  1780. // 입력값 확인
  1781. String goodsPriceResvCheck = getGoodsPriceResvCheck(goodsPriceList);
  1782. if (!"SUCC".equals(goodsPriceResvCheck)) {
  1783. this.deleteExceluploadFile(targetPath, excelFilename);
  1784. throw new IllegalStateException(goodsPriceResvCheck);
  1785. }
  1786. int index = 0;
  1787. for (GoodsPriceRes goodsPriceRes : goodsPriceList) {
  1788. goodsPriceRes.setUpdNo(TsaSession.getInfo().getUserNo());
  1789. goodsPriceRes.setRegNo(TsaSession.getInfo().getUserNo());
  1790. //예약일시 시분 설정
  1791. goodsPriceRes.setApplyStdt(goodsPriceRes.getApplyStdt() + "0000");
  1792. goodsPriceRes.setApplyEddt(goodsPriceRes.getApplyEddt() + "5959");
  1793. // 엑셀조회를 위한 SEARCH 테이블 생성
  1794. SearchData searchData = new SearchData();
  1795. searchData.setRegNo(goodsPriceRes.getRegNo());
  1796. searchData.setSearchCd(goodsPriceRes.getGoodsCd());
  1797. searchData.setDispOrd(index);
  1798. if (index == 0) {
  1799. commonService.deleteExceluploadSearCh(searchData);
  1800. }
  1801. commonService.createExceluploadSearch(searchData);
  1802. goodsDao.createGoodPriceRes(goodsPriceRes);
  1803. index++;
  1804. }
  1805. }
  1806. /*
  1807. * 상품 가격예약 엑셀조회용 상품 저장 - 입력값 확인
  1808. */
  1809. private String getGoodsPriceResvCheck(Collection<GoodsPriceRes> goodsPriceList) {
  1810. int cnt = 0;
  1811. for (GoodsPriceRes goodsPriceRes : goodsPriceList) {
  1812. if (StringUtils.isEmpty(goodsPriceRes.getGoodsCd())) {
  1813. return (cnt + 2) + "행의 상품코드를 확인해주세요";
  1814. }
  1815. if (StringUtils.isEmpty(goodsPriceRes.getResGoodsPrice())) {
  1816. return (cnt + 2) + "행의 예약가격을 확인해주세요.";
  1817. }
  1818. if (goodsPriceRes.getResGoodsPrice() <= 0) {
  1819. return (cnt + 2) + "행의 예약가격을 확인해주세요.";
  1820. }
  1821. String nowDate = GagaDateUtil.getToday(); //yyyyMMddHH
  1822. SimpleDateFormat dateFormatParser = new SimpleDateFormat("yyyyMMddHH");
  1823. dateFormatParser.setLenient(false);
  1824. try {
  1825. dateFormatParser.parse(goodsPriceRes.getApplyStdt() );
  1826. } catch (Exception e) {
  1827. return (cnt + 2) + "행의 예약시작일시을 확인해주세요.";
  1828. }
  1829. try {
  1830. dateFormatParser.parse(goodsPriceRes.getApplyEddt() );
  1831. } catch (Exception e) {
  1832. return (cnt + 2) + "행의 예약종료일시을 확인해주세요.";
  1833. }
  1834. if (Integer.parseInt(goodsPriceRes.getApplyStdt()) > Integer.parseInt(goodsPriceRes.getApplyEddt())) {
  1835. return (cnt + 2) + "행의 예약 시작일시은 종료일시보다 보다 클 수 없습니다.";
  1836. }
  1837. if (Integer.parseInt(goodsPriceRes.getApplyStdt()) <= Integer.parseInt(nowDate)) {
  1838. return (cnt + 2) + "행의 예약 시작일자는 현재일자 보다 작거나 같을 수 없습니다.";
  1839. }
  1840. //정상가와 비교
  1841. Goods searchGoods = new Goods();
  1842. searchGoods.setGoodsCd(goodsPriceRes.getGoodsCd());
  1843. Goods goods = goodsDao.getGoods(searchGoods);
  1844. if (goods == null) {
  1845. return (cnt + 2) + "행의 상품코드를 확인해주세요";
  1846. }
  1847. if (goods.getListPrice() < goodsPriceRes.getResGoodsPrice()) {
  1848. return (cnt + 2) + "행의 상품 정상가보다 예약판매가가 더 큽니다.";
  1849. }
  1850. if (!"Y".equals(goods.getSelfGoodsYn())) {
  1851. return (cnt + 2) + "행의 상품은 자사상품이 아닙니다.";
  1852. }
  1853. if(goodsDao.getGoodsPriceResDupChkCount(goodsPriceRes) > 0 ) {
  1854. return (cnt + 2) + "행은 이미 등록된 상품 가격예약이 존재합니다. \n(상품코드 : " + goodsPriceRes.getGoodsCd() + ")";
  1855. }
  1856. cnt++;
  1857. }
  1858. return "SUCC";
  1859. }
  1860. /**
  1861. * 상품 동영상 목록 조회
  1862. *
  1863. * @param goodsVideo
  1864. * @return
  1865. * @author eskim
  1866. * @since 2020. 11. 16
  1867. */
  1868. public Collection<GoodsVideo> getGoodsVideoList(GoodsVideo goodsVideo) {
  1869. return goodsDao.getGoodsVideoList(goodsVideo);
  1870. }
  1871. /**
  1872. * 상품 동영상 삭제로 변경
  1873. *
  1874. * @param goodsVideo
  1875. * @return
  1876. * @author eskim
  1877. * @since 2020. 11. 16
  1878. */
  1879. @Transactional("shopTxnManager")
  1880. public void updateNotUseGoodsVideo(Collection<GoodsVideo> goodsVideos) {
  1881. for (GoodsVideo goodsVideo : goodsVideos) {
  1882. Video video = new Video();
  1883. video.setUpdNo(TsaSession.getInfo().getUserNo());
  1884. video.setVideoSq(goodsVideo.getVideoSq());
  1885. goodsDao.updateNotUseGoodsVideo(video);
  1886. }
  1887. }
  1888. /**
  1889. * 상품동영상 수정/저장
  1890. *
  1891. * @param video
  1892. * @return
  1893. * @author eskim
  1894. * @since 2020. 11. 16
  1895. */
  1896. @Transactional("shopTxnManager")
  1897. public void saveGoodsVideo(Video video) {
  1898. video.setRegNo(TsaSession.getInfo().getUserNo());
  1899. video.setUpdNo(TsaSession.getInfo().getUserNo());
  1900. if (video.getVideoSq() == null || video.getVideoSq() == 0) {
  1901. String videoSeq = goodsDao.getVideoSeq(video);
  1902. if (StringUtils.isEmpty(videoSeq)) {
  1903. goodsDao.createVideo(video);
  1904. }else {
  1905. //video.setVideoSq(Integer.parseInt(videoSeq)); //why?
  1906. //goodsDao.updateVideo(video);
  1907. }
  1908. }
  1909. if (video.getVideoSq() == null || video.getVideoSq() == 0) {
  1910. String videoSeq = goodsDao.getVideoSeq(video);
  1911. if (!StringUtils.isEmpty(videoSeq)) {
  1912. video.setVideoSq(Integer.parseInt(videoSeq));
  1913. }
  1914. }
  1915. //goodsDao.delVideoDispLoc(video); why?
  1916. String[] displocValArr = video.getDisplocValArr();
  1917. for (String displocVal : displocValArr) {
  1918. video.setDisplocVal(displocVal);
  1919. goodsDao.saveVideoDispLoc(video);
  1920. }
  1921. }
  1922. /**
  1923. * 상품동영상 엑셀파일 등록
  1924. *
  1925. * @param dataList
  1926. * @return
  1927. * @author eskim
  1928. * @since 2020. 11. 16
  1929. */
  1930. @Transactional("shopTxnManager")
  1931. public int saveExcelGoodsVideo(Collection<GagaMap> dataList) {
  1932. int cnt = 0;
  1933. for (GagaMap map : dataList) {
  1934. Video video = mapper.convertValue(map, Video.class);
  1935. video.setUpdNo(TsaSession.getInfo().getUserNo());
  1936. video.setRegNo(TsaSession.getInfo().getUserNo());
  1937. video.setDisplocGb("G");
  1938. video.setDispYn("Y");
  1939. String videoVal = video.getVideoVal();
  1940. if (videoVal.contains("http")) {
  1941. video.setVideoGb("M");
  1942. } else {
  1943. video.setVideoGb("Y");
  1944. }
  1945. String videoSeq = goodsDao.getVideoSeq(video);
  1946. if (StringUtils.isEmpty(videoSeq)) {
  1947. goodsDao.createVideo(video);
  1948. }
  1949. videoSeq = goodsDao.getVideoSeq(video);
  1950. if (!StringUtils.isEmpty(videoSeq)) {
  1951. video.setVideoSq(Integer.parseInt(videoSeq));
  1952. }
  1953. goodsDao.saveVideoDispLoc(video);
  1954. cnt++;
  1955. }
  1956. return cnt;
  1957. }
  1958. /**
  1959. * 상품별 옵션 등록 여부 확인
  1960. *
  1961. * @param
  1962. * @return
  1963. * @author eskim
  1964. * @since 2020. 11. 17
  1965. */
  1966. public int getGoodsOptionCount(Option option) {
  1967. return goodsDao.getGoodsOptionCount(option);
  1968. }
  1969. /**
  1970. * 상품 가격승인관리 목록 조회
  1971. *
  1972. * @param goodsPriceHst
  1973. * @return
  1974. * @author eskim
  1975. * @since 2020. 11. 26
  1976. */
  1977. public Collection<GoodsPriceRes> getGoodsSupplyPriceList(GoodsPriceRes goodsPriceHst) {
  1978. return goodsDao.getGoodsSupplyPriceList(goodsPriceHst);
  1979. }
  1980. /**
  1981. * 상품 가격승인관리 승인 처리
  1982. *
  1983. * @param goodsPriceHstList - 상품 가격 승인 목록
  1984. * @author eskim
  1985. * @since 2020. 11. 26
  1986. */
  1987. @Transactional("shopTxnManager")
  1988. public void saveGoodsSupplyPrice(Collection<GoodsPriceRes> goodsPriceHstList) {
  1989. for (GoodsPriceRes goodsPriceRes : goodsPriceHstList) {
  1990. goodsPriceRes.setRegNo(TsaSession.getInfo().getUserNo());
  1991. goodsPriceRes.setUpdNo(TsaSession.getInfo().getUserNo());
  1992. Goods goods = new Goods();
  1993. goods.setRegNo(TsaSession.getInfo().getUserNo());
  1994. goods.setUpdNo(TsaSession.getInfo().getUserNo());
  1995. goods.setGoodsCd(goodsPriceRes.getGoodsCd());
  1996. goodsDao.createGoodsHst(goods);
  1997. // 판매가 변경
  1998. if (goodsPriceRes.getResGoodsPrice() > 0) {
  1999. log.info("goodsPriceRes.getTagPrice() ={}", goodsPriceRes.getListPrice());
  2000. log.info("goodsPriceRes.getResGoodsPrice() ={}", goodsPriceRes.getResGoodsPrice());
  2001. goods.setDcRate((int)(this.getDcRate(goodsPriceRes.getListPrice(), goodsPriceRes.getResGoodsPrice())));
  2002. goods.setCurrBprice(goodsPriceRes.getCurrPrice());
  2003. goods.setCurrPrice(goodsPriceRes.getResGoodsPrice());
  2004. goodsDao.updateGoodsPrice(goods);
  2005. }
  2006. // 판매수수료율 변경
  2007. if (goodsPriceRes.getSellFeeRate() != null) {
  2008. goods.setSellFeeRate(goodsPriceRes.getSellFeeRate());
  2009. goodsDao.updateSellFeeRate(goods);
  2010. }
  2011. goodsDao.updateGoodsSupplyPricecfrmDt(goodsPriceRes);
  2012. }
  2013. }
  2014. /**
  2015. * 상품 네이버 최저가 목록
  2016. *
  2017. * @param goodsSearch
  2018. * @return
  2019. * @author eskim
  2020. * @since 2020. 12. 08
  2021. */
  2022. public Collection<GoodsNaverLowestPrice> getGoodsNaverPriceList(GoodsSearch goodsSearch) {
  2023. return goodsDao.getGoodsNaverPriceList(goodsSearch);
  2024. }
  2025. /**
  2026. * 상품 네이버 최저가 목록
  2027. *
  2028. * @param goodsSearch
  2029. * @return
  2030. * @author eskim
  2031. * @since 2020. 12. 08
  2032. */
  2033. @Transactional("shopTxnManager")
  2034. public Collection<GoodsNaverLowestPrice> saveGoodsNaverPrice(GoodsSearch goodsSearch) {
  2035. // 1. 조회 상품 TB_SEARCH_DATA 담기
  2036. int index = 0;
  2037. for (String goodsCd : goodsSearch.getConditionList()) {
  2038. SearchData searchData = new SearchData();
  2039. searchData.setRegNo(TsaSession.getInfo().getUserNo());
  2040. searchData.setSearchCd(goodsCd);
  2041. if (index == 0) {
  2042. commonService.deleteExceluploadSearCh(searchData);
  2043. }
  2044. commonService.createExceluploadSearch(searchData);
  2045. index++;
  2046. }
  2047. // 2. 일 최초 조회이면 테이블 삭제
  2048. String regYmd = goodsDao.getGoodsNaverLowestPriceReqYmd();
  2049. if (!StringUtils.isEmpty(regYmd) && !regYmd.equals(GagaDateUtil.getToday())) {
  2050. goodsDao.deleteGoodsNaverLowestPrice();
  2051. }
  2052. // 3. 네이버 최저가 조회 저장
  2053. saveGoodsNaverLowestPrice(goodsSearch);
  2054. // 4. 최저가 상품 조회
  2055. goodsSearch.setSearchGb("EXCEL");
  2056. goodsSearch.setRegNo(TsaSession.getInfo().getUserNo()); // 엑셀조회시 로그인 사용자의 엑셀 상품조회시 사용
  2057. return goodsDao.getGoodsNaverPriceList(goodsSearch);
  2058. }
  2059. /**
  2060. * 상품 네이버 최저가 목록
  2061. *
  2062. * @param goodsSearch
  2063. * @return
  2064. * @author eskim
  2065. * @since 2020. 12. 08
  2066. */
  2067. private void saveGoodsNaverLowestPrice(GoodsSearch goodsSearch) {
  2068. for (String goodsCd : goodsSearch.getConditionList()) {
  2069. try {
  2070. log.info("saveGoodsNaverLowestPrice 11 = {}", GagaDateUtil.getTodayDateTime());
  2071. TaskSleeep();
  2072. log.info("saveGoodsNaverLowestPrice 22 = {}", GagaDateUtil.getTodayDateTime());
  2073. NaverLowestPrice naverLowestPrice = naverLowestPriceApi.getLowestPrice(goodsCd);
  2074. log.info("[saveGoodsNaverLowestPrice] naverLowestPrice= {}",naverLowestPrice);
  2075. if (naverLowestPrice != null) {
  2076. GoodsNaverLowestPrice goodsNaverLowestPrice = new GoodsNaverLowestPrice();
  2077. goodsNaverLowestPrice.setReqYmd(GagaDateUtil.getToday());
  2078. goodsNaverLowestPrice.setGoodsCd(goodsCd);
  2079. goodsNaverLowestPrice.setMallNm(naverLowestPrice.getItems().iterator().next().getMallName());
  2080. goodsNaverLowestPrice.setMallLink(naverLowestPrice.getItems().iterator().next().getLink());
  2081. goodsNaverLowestPrice.setLowestPrice(naverLowestPrice.getItems().iterator().next().getLprice());
  2082. goodsNaverLowestPrice.setRegNo(TsaSession.getInfo().getUserNo());
  2083. goodsNaverLowestPrice.setUpdNo(TsaSession.getInfo().getUserNo());
  2084. log.info("[saveGoodsNaverLowestPrice] goodsNaverLowestPrice= {}", goodsNaverLowestPrice);
  2085. goodsDao.saveGoodsNaverLowestPrice(goodsNaverLowestPrice);
  2086. }
  2087. } catch (Exception e) {
  2088. e.printStackTrace();
  2089. }
  2090. }
  2091. }
  2092. /**
  2093. *
  2094. *
  2095. * @return
  2096. * @author eskim
  2097. * @since 2020. 12. 08
  2098. */
  2099. static void TaskSleeep() {
  2100. try {
  2101. Thread.sleep(100);
  2102. } catch (InterruptedException e) {
  2103. // TODO Auto-generated catch block
  2104. e.printStackTrace();
  2105. }
  2106. }
  2107. /**
  2108. * 광고 키워드 목록
  2109. *
  2110. * @param adKeyword
  2111. * @return
  2112. * @author eskim
  2113. * @since 2020. 12. 15
  2114. */
  2115. public Collection<AdKeyword> getAdKeywordList(AdKeyword adKeyword) {
  2116. return goodsDao.getAdKeywordList(adKeyword);
  2117. }
  2118. /**
  2119. * 광고 키워드 상품 목록
  2120. *
  2121. * @param adKeyword
  2122. * @return
  2123. * @author eskim
  2124. * @since 2020. 12. 15
  2125. */
  2126. public Collection<AdKeywordGoods> getAdKeywordGoodsList(AdKeyword adKeyword) {
  2127. return goodsDao.getAdKeywordGoodsList(adKeyword);
  2128. }
  2129. /**
  2130. * 광고 키워드 저장
  2131. * @param adKeyword
  2132. * @return
  2133. * @author eskim
  2134. * @since 2020. 12. 15
  2135. */
  2136. @Transactional("shopTxnManager")
  2137. public void saveAdKeywordGoods(AdKeyword adKeyword) {
  2138. adKeyword.setRegNo(TsaSession.getInfo().getUserNo());
  2139. adKeyword.setUpdNo(TsaSession.getInfo().getUserNo());
  2140. // 신규 일때
  2141. if (adKeyword.getAdKeywordSq() == null) {
  2142. // 공지사항 저장
  2143. goodsDao.saveAdKeyword(adKeyword);
  2144. // 등록된 사용자번호 값 가져오기
  2145. Integer noticeSq = adKeyword.getAdKeywordSq();
  2146. adKeyword.setAdKeywordSq(noticeSq);
  2147. } else {
  2148. // 공지사항 수정
  2149. goodsDao.saveAdKeyword(adKeyword);
  2150. }
  2151. if (!StringUtils.isEmpty(adKeyword.getGoodsList())) {
  2152. Collection<AdKeywordGoods> adKeywordGoodsList = null;
  2153. try {
  2154. adKeywordGoodsList = mapper.readValue(adKeyword.getGoodsList(), new TypeReference<Collection<AdKeywordGoods>>() {
  2155. });
  2156. } catch (Exception e) {
  2157. e.printStackTrace();
  2158. throw new IllegalStateException(message.getMessage("광고 키워드 저장 중 오류로 인해 저장되지 않았습니다."));
  2159. }
  2160. log.info("adKeywordGoodsList: {}", adKeywordGoodsList);
  2161. int idx = 0;
  2162. for (AdKeywordGoods adKeywordGoods : adKeywordGoodsList) {
  2163. if (idx == 0) goodsDao.deleteAdKeywordGoods(adKeywordGoods); // 전체 상품 삭제
  2164. adKeywordGoods.setAdKeywordSq(adKeyword.getAdKeywordSq());
  2165. adKeywordGoods.setRegNo(TsaSession.getInfo().getUserNo());
  2166. adKeywordGoods.setUpdNo(TsaSession.getInfo().getUserNo());
  2167. goodsDao.saveAdKeywordGoods(adKeywordGoods);
  2168. idx++;
  2169. }
  2170. }
  2171. }
  2172. /**
  2173. * 광고 키워드 상품 삭제
  2174. * @param adKeywordGoods
  2175. * @return
  2176. * @author eskim
  2177. * @since 2020. 12. 15
  2178. */
  2179. @Transactional("shopTxnManager")
  2180. public void deleteAdKeywordGoods(AdKeywordGoods adKeywordGoods) {
  2181. if (adKeywordGoods == null || (adKeywordGoods.getArrGoodsCd() == null && adKeywordGoods.getArrGoodsCd().length <= 0)) {
  2182. throw new IllegalStateException(message.getMessage("FAIL_1001"));
  2183. }
  2184. if (adKeywordGoods.getArrGoodsCd().length > 0) {
  2185. goodsDao.deleteAdKeywordGoods(adKeywordGoods);
  2186. }
  2187. }
  2188. /**
  2189. * 재입고알림 목록 건수
  2190. *
  2191. * @param goodsSearch
  2192. * @return Integer
  2193. * @author eskim
  2194. * @since 2020. 12. 16
  2195. */
  2196. public int getReinboundInformCount(GoodsSearch goodsSearch) {
  2197. return goodsDao.getReinboundInformCount(goodsSearch);
  2198. }
  2199. /**
  2200. * 재입고알림 목록
  2201. *
  2202. * @param goodsSearch
  2203. * @return Collection<ReinboundInform>
  2204. * @author eskim
  2205. * @since 2020. 12. 16
  2206. */
  2207. public Collection<ReinboundInform> getReinboundInformList(GoodsSearch goodsSearch) {
  2208. return goodsDao.getReinboundInformList(goodsSearch);
  2209. }
  2210. /**
  2211. * 재입고알림 발송 처리
  2212. *
  2213. * @param params
  2214. * @return void
  2215. * @author daehyoung
  2216. * @since 2020. 07 .21
  2217. */
  2218. @Transactional("shopTxnManager")
  2219. public void sendReinboundInform(ReinboundInform reinboundInform) {
  2220. if (reinboundInform.getArrRinbdInfoSq().length <= 0) {
  2221. throw new IllegalStateException(message.getMessage("FAIL_1001"));
  2222. }
  2223. int idx = 0;
  2224. for (String rinbdInfoSq : reinboundInform.getArrRinbdInfoSq()) {
  2225. GoodsSearch goodsSearch = new GoodsSearch();
  2226. goodsSearch.setRinbdInfoSq(Integer.parseInt(rinbdInfoSq));
  2227. Collection<ReinboundInform> list = goodsDao.getReinboundInformList(goodsSearch);
  2228. ReinboundInform oneParam = null;
  2229. if (list.size() == 1) {
  2230. oneParam = list.iterator().next();
  2231. } else {
  2232. continue;
  2233. }
  2234. // 재고체크
  2235. if (oneParam.getCurrStockQty() < 1 || "Y".equals(oneParam.getSoldoutYn())) {
  2236. throw new IllegalStateException(oneParam.getGoodsCd() + "상품( 사이즈 : " + oneParam.getOptCd1() + " )은 가용재고가 없습니다.");
  2237. }
  2238. oneParam.setRegNo(TsaSession.getInfo().getUserNo());
  2239. oneParam.setUpdNo(TsaSession.getInfo().getUserNo());
  2240. // **** 알림톡 발송 start ****
  2241. try {
  2242. log.info("[카카오 알림톡 발송 정보] - 재입고알림 발송: " + oneParam.toString());
  2243. /////////////////////////////////////////////////////
  2244. //kakaoService.sendGoodsRestock(oneParam); //나중에 수정해요 eskim
  2245. /////////////////////////////////////////////////////
  2246. } catch (Exception e) {
  2247. e.getStackTrace();
  2248. throw new IllegalStateException("재입고알림 알림톡 발송을 실패하였습니다.");
  2249. }
  2250. // **** 알림톡 발송 end ****
  2251. // 재입고알림 발송처리
  2252. goodsDao.updateReinboundInform(oneParam);
  2253. idx++;
  2254. }
  2255. }
  2256. /**
  2257. * 상품이미지 목록
  2258. *
  2259. * @param goodsImg
  2260. * @return Collection<GoodsImg>
  2261. * @author eskim
  2262. * @since 2020. 12. 18
  2263. */
  2264. public Collection<GoodsImg> getGoodsImgList(GoodsImg goodsImg) {
  2265. return goodsDao.getGoodsImageList(goodsImg);
  2266. }
  2267. /**
  2268. * 상품이미지 저장 처리
  2269. * @param goodsImgList - 상품이미지 목록
  2270. * @throws AdmBizException
  2271. * @author eskim
  2272. * @since 2020. 12. 21
  2273. */
  2274. @Transactional("shopTxnManager")
  2275. public void saveGoodsImageList(Collection<GoodsImg> goodsImgList){
  2276. int index = 0;
  2277. for (GoodsImg goodsImg : goodsImgList) {
  2278. // 상품이미지 전체 삭제
  2279. if (index++ == 0) {
  2280. goodsDao.deleteGoodsImageTotal(goodsImg);
  2281. }
  2282. if (!goodsImg.getMode().equals("D")) {
  2283. // 상품이미지 등록
  2284. goodsImg.setRegNo(TsaSession.getInfo().getUserNo());
  2285. goodsDao.createGoodsImage(goodsImg);
  2286. }
  2287. }
  2288. }
  2289. /**
  2290. * 사은품 목록
  2291. *
  2292. * @param goodsSearch
  2293. * @return Collection<FreeGoods>
  2294. * @author eskim
  2295. * @since 2020. 12. 28
  2296. */
  2297. public Collection<FreeGoods> getFreeGoodsList(GoodsSearch goodsSearch) {
  2298. return goodsDao.getFreeGoodsList(goodsSearch);
  2299. }
  2300. /**
  2301. * 사은품 정보 수정
  2302. * @param goodsImgList - 상품이미지 목록
  2303. * @throws AdmBizException
  2304. * @author eskim
  2305. * @since 2020. 12. 21
  2306. */
  2307. @Transactional("shopTxnManager")
  2308. public void updateFreeGoods(FreeGoods freeGoods){
  2309. freeGoods.setUpdNo(TsaSession.getInfo().getUserNo());
  2310. goodsDao.updateFreeGoods(freeGoods);
  2311. }
  2312. /**
  2313. * WMS입고상품관리 목록 건수
  2314. *
  2315. * @param goodsSearch
  2316. * @return Collection<WmsGoods>
  2317. * @author eskim
  2318. * @since 2021. 01. 04
  2319. */
  2320. public int getGoodsWmsIncomelotListCount(WmsGoods wmsGoods) {
  2321. return goodsDao.getGoodsWmsIncomelotListCount(wmsGoods);
  2322. }
  2323. /**
  2324. * WMS입고상품관리 목록 조회
  2325. *
  2326. * @param goodsSearch
  2327. * @return Collection<WmsGoods>
  2328. * @author eskim
  2329. * @since 2021. 01. 04
  2330. */
  2331. public Collection<WmsGoods> getGoodsWmsIncomelotList(WmsGoods wmsGoods) {
  2332. return goodsDao.getGoodsWmsIncomelotList(wmsGoods);
  2333. }
  2334. /**
  2335. * WMS 입고상품 사은품 등록
  2336. * @param wmsGoodsList
  2337. * @author eskim
  2338. * @since 2021. 01. 05
  2339. */
  2340. @Transactional("shopTxnManager")
  2341. public void saveFreeGoods(Collection<WmsGoods> wmsGoodsList){
  2342. for (WmsGoods wmsGoods: wmsGoodsList) {
  2343. FreeGoods freeGoods = new FreeGoods();
  2344. freeGoods.setProductNo(wmsGoods.getProductNo());
  2345. freeGoods.setProductCode(wmsGoods.getProductCode());
  2346. freeGoods.setGoodsNum(wmsGoods.getModelNo());
  2347. freeGoods.setBrandCd(wmsGoods.getBrandCd());
  2348. freeGoods.setGoodsNm(wmsGoods.getProductName());
  2349. freeGoods.setUseYn("Y");
  2350. freeGoods.setUpdNo(TsaSession.getInfo().getUserNo());
  2351. freeGoods.setRegNo(TsaSession.getInfo().getUserNo());
  2352. goodsDao.saveFreeGoods(freeGoods);
  2353. //WMS 상품등록구분
  2354. wmsGoods.setGoodsRegGb("F");
  2355. wmsGoods.setUpdNo(TsaSession.getInfo().getUserNo());
  2356. wmsGoods.setRegNo(TsaSession.getInfo().getUserNo());
  2357. goodsDao.saveGoodsWmsIncomelot(wmsGoods);
  2358. }
  2359. }
  2360. }