package Ġcom . ts uk ise ele . pot of u . services . impl Ċ Ċ import Ġcom . ts uk ise ele . pot of u . map pers . Visitor Mapper Ċ import Ġcom . ts uk ise ele . pot of u . models . Visitor Ċ import Ġcom . ts uk ise ele . pot of u . services . Visitor Service Ċ import Ġcom . ts uk ise ele . utils . Ip Util Ċ import Ġorg . slf 4 j . LoggerFactory Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . stereotype . Service Ċ import Ġjava . util .* Ċ import Ġjavax . servlet . http . Cookie Ċ import Ġjavax . servlet . http . HttpServletRequest Ċ import Ġjavax . servlet . http . HttpServletResponse Ċ Ċ @ Service Ċ class ĠVisitor ServiceImpl Ċ @ Autowired Ġconstructor ( private Ġval Ġvisitor Mapper : ĠVisitor Mapper ) Ġ: ĠVisitor Service Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġget Visitor ById ( visitor Id : ĠInt ): ĠVisitor Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġvisitor Mapper . query Visitor ById ( visitor Id ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġcreate ( visitor : ĠVisitor , Ġrequest : ĠHttpServletRequest ?, Ġresponse : ĠHttpServletResponse ): ĠInt Ġ{ ĊĠĠĠĠĠĠĠ Ġvisitor . visitor Ip Ġ= Ġrequest ?. let Ġ{ ĠIp Util . client Ip ( request ) Ġ} ĊĠĠĠĠĠĠĠ Ġvisitor . visitor Datetime Ġ= ĠDate () ĊĠĠĠĠĠĠĠ Ġresponse . add Cookie ( Cookie (" visitor _ nickname ", Ġvisitor . visitor Name )) ĊĠĠĠĠĠĠĠ Ġresponse . add Cookie ( Cookie (" visitor _ email ", Ġvisitor . visitor Email )) ĊĠĠĠĠĠĠĠ Ġreturn Ġvisitor Mapper . insert ( visitor ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġprivate Ġval ĠLOGGER Ġ= ĠLoggerFactory . getLogger ( Visitor ServiceImpl :: class . java ) ĊĠĠĠ Ġ} Ċ }