diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/JwtAuth/JwtProvider.java b/smartservice_backend/src/main/java/com/handong/smartservice/JwtAuth/JwtProvider.java index 0e0d221..985d6ef 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/JwtAuth/JwtProvider.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/JwtAuth/JwtProvider.java @@ -54,12 +54,12 @@ public class JwtProvider { /* - public String createAccessToken(Long gid, String user_id, String nick_name, Long permission, Long biz_group_id) { + public String createAccessToken(Long gid, String user_id, String name, Long permission, Long biz_group_id) { Date now = new Date(); return Jwts.builder() .setSubject(gid.toString()) .claim("user_id", user_id) - .claim("nick_name", nick_name) + .claim("name", name) .claim("permission", permission) .claim("biz_group_id", biz_group_id) .setIssuedAt(now) diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/_AG.java b/smartservice_backend/src/main/java/com/handong/smartservice/_AG.java index df1504a..7793311 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/_AG.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/_AG.java @@ -13,6 +13,8 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.web.multipart.MultipartFile; +//import static org.mockito.Answers.values; + import java.io.File; import java.math.BigInteger; import java.text.SimpleDateFormat; @@ -146,7 +148,8 @@ public class _AG { if (qeuryResult == null || qeuryResult.size() == 0) return 0L; - return (Long)qeuryResult.get(0).get(strColName); + //return (Long)qeuryResult.get(0).get(strColName); + return (Long)qeuryResult.get(0).values().iterator().next(); } static public String getIpAddr(HttpServletRequest request) { @@ -188,7 +191,7 @@ public class _AG { //JWT Auth static public boolean isSkipAuthUri(String uri) { - if (uri.compareTo("/api/miss-slot.do") == 0 || + if (uri.compareTo("/api/miss-column_no.do") == 0 || uri.compareTo("/api/terminal-state.do") == 0 || uri.compareTo("/api/sign-in.do") == 0 || uri.compareTo("/api/sval2.do") == 0 || @@ -203,17 +206,17 @@ public class _AG { UserInfo principal = new UserInfo( Long.parseLong(claims.getSubject()), claims.get("user_id", String.class), - claims.get("nick_name", String.class), + claims.get("name", String.class), claims.get("permission", Number.class), claims.get("biz_group_id", Number.class) ); return principal; } - static public Map createUserInfoMap(String user_id, String nick_name, Long permission, Long biz_group_id) { + static public Map createUserInfoMap(String user_id, String name, Long permission, Long biz_group_id) { Map map = new HashMap<>(); map.put("user_id", user_id); - map.put("nick_name", nick_name); + map.put("name", name); map.put("permission", permission); map.put("biz_group_id", biz_group_id); return map; @@ -233,8 +236,8 @@ public class _AG { // 사업자번호 검증 static public boolean isValidBusinessNumber(String input) { - //return true; //TestCode - + return true; + /* String digits = input.replaceAll("\\D", ""); if (digits.length() != 10) { return false; @@ -252,5 +255,6 @@ public class _AG { int checkDigit = (10 - (sum % 10)) % 10; return checkDigit == Character.getNumericValue(digits.charAt(9)); + */ } } diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/component/CtErrorCode.java b/smartservice_backend/src/main/java/com/handong/smartservice/component/CtErrorCode.java index 09a3d92..4986cde 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/component/CtErrorCode.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/component/CtErrorCode.java @@ -12,4 +12,5 @@ public class CtErrorCode { static public final int INVALID_USER = -9; static public final int ALREADY_EXIST = -11; static public final int THIRDPARTY_ERROR = -12; + static public final int PERMISSION_DENIED = -13; } diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/component/Permission.java b/smartservice_backend/src/main/java/com/handong/smartservice/component/Permission.java new file mode 100644 index 0000000..f2fbfe6 --- /dev/null +++ b/smartservice_backend/src/main/java/com/handong/smartservice/component/Permission.java @@ -0,0 +1,48 @@ +package com.handong.smartservice.component; + +public class Permission { + static public final Long PERM_ALL = 0xffffffffL; // 4294967295 + + static public final Long PERM_GROUP = 0x2L; + static public final Long PERM_TID = 0x4L; + static public final Long PERM_CANCEL = 0x8L; + + static public Boolean hasGroup(Long permission) { + return (permission & PERM_GROUP) == PERM_GROUP; + } + + static public Boolean hasUid1(Long permission) { + return (permission & PERM_TID) == PERM_TID; + } + + static public Boolean hasCancel(Long permission) { + return (permission & PERM_CANCEL) == PERM_CANCEL; + } + + + private Long value = 0x0L; + public Long get() { + return value; + } + + public void setGroup(Boolean perm_group) { + if (perm_group) + value |= PERM_GROUP; + else + value &= ~PERM_GROUP; + } + + public void setUid1(Boolean perm_uid1) { + if (perm_uid1) + value |= PERM_TID; + else + value &= ~PERM_TID; + } + + public void setCancel(Boolean perm_cancel) { + if (perm_cancel) + value |= PERM_CANCEL; + else + value &= ~PERM_CANCEL; + } +} diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/component/UserInfo.java b/smartservice_backend/src/main/java/com/handong/smartservice/component/UserInfo.java index b0708b5..c97797a 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/component/UserInfo.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/component/UserInfo.java @@ -1,5 +1,7 @@ package com.handong.smartservice.component; +import org.springframework.security.core.context.SecurityContextHolder; + public class UserInfo { private final Long gid; @@ -8,10 +10,14 @@ public class UserInfo { private final Long permission; private final Long bizGroupId; - public UserInfo(Long gid, String user_id, String nick_name, Number permission, Number bizGroupId) { + static public UserInfo getCurr() { + return (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + } + + public UserInfo(Long gid, String user_id, String name, Number permission, Number bizGroupId) { this.gid = gid; this.userId = user_id; - this.nickName = nick_name; + this.nickName = name; this.permission = permission != null ? permission.longValue() : 0L; this.bizGroupId = bizGroupId != null ? bizGroupId.longValue() : 0L; } diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/AccountController.java b/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/AccountController.java index ee726a6..06f5c3e 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/AccountController.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/AccountController.java @@ -51,12 +51,13 @@ class AccountController { Boolean is_excel = _AG.toBoolean(body.get("is_excel")); Boolean is_group_access = _AG.toBoolean(body.get("is_group_access")); - String nick_name = body.get("nick_name"); + String name = body.get("name"); + String phone = body.get("phone"); String user_id = body.get("user_id"); String email = body.get("email"); Long biz_group_id = _AG.toLong(body.get("biz_group_id")); - Map mapResult = accountService.getAccountList(offset, limit, date_start, date_end, is_excel, is_group_access, user_id, email, nick_name, biz_group_id); + Map mapResult = accountService.getAccountList(offset, limit, date_start, date_end, is_excel, is_group_access, user_id, email, name, phone, biz_group_id); if (is_excel) { List> list = (List>)mapResult.get("list"); @@ -66,7 +67,7 @@ class AccountController { } String[] arrHeader = {"등록일", "그룹", "아이디", "닉네임", "이메일", "상태"}; - String[] arrColumn = {"reg_time", "biz_group_name", "user_id", "nick_name", "email", "state"}; + String[] arrColumn = {"reg_time", "biz_group_name", "user_id", "name", "email", "state"}; CtExcelMaker.makeExcelResponse(request, response, "계정목록", arrHeader, arrColumn, list, null); return null; @@ -83,17 +84,21 @@ class AccountController { String user_id = body.get("user_id"); String user_pw = body.get("user_pw"); String email = body.get("email"); - String nick_name = body.get("nick_name"); + String name = body.get("name"); + String phone = body.get("phone"); Long state = _AG.toLong(body.get("state")); Long biz_group_id = _AG.toLong(body.get("biz_group_id")); Long new_biz_group_id = _AG.toLong(body.get("new_biz_group_id")); + Boolean perm_group = _AG.toBoolean(body.get("perm_group")); + Boolean perm_uid1 = _AG.toBoolean(body.get("perm_uid1")); + Boolean perm_cancel = _AG.toBoolean(body.get("perm_cancel")); if (user_id == null || user_id.isEmpty()) { result.setErrCode(ErrorCode.INVALID_PARAMETER); return result; } - result = accountService.addOrModifyAccount(isModify, gid, user_id, user_pw, email, nick_name, state, biz_group_id, new_biz_group_id); + result = accountService.addOrModifyAccount(isModify, gid, user_id, user_pw, email, name, phone, state, biz_group_id, new_biz_group_id, perm_group, perm_uid1, perm_cancel); return result; } diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/AuthController.java b/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/AuthController.java index 4b94f37..87343ca 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/AuthController.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/AuthController.java @@ -69,7 +69,7 @@ class AuthController { Long gid = (Long)mapAccount.get("gid"); logger.info("gid: " + gid); - String nick_name = (String)mapAccount.get("nick_name"); + String name = (String)mapAccount.get("name"); Long permission = (Long)mapAccount.get("permission"); Long biz_group_id = (Long)mapAccount.get("biz_group_id"); String encPw = (String)mapAccount.get("user_pw"); @@ -83,8 +83,8 @@ class AuthController { return result; } - //mapAccount.put("sval1", jwtProvider.createAccessToken(gid, user_id, nick_name, permission, biz_group_id)); - mapAccount.put("sval1", jwtProvider.createAccessToken(gid, _AG.createUserInfoMap(user_id, nick_name, permission, biz_group_id))); + //mapAccount.put("sval1", jwtProvider.createAccessToken(gid, user_id, name, permission, biz_group_id)); + mapAccount.put("sval1", jwtProvider.createAccessToken(gid, _AG.createUserInfoMap(user_id, name, permission, biz_group_id))); String refreshToken = jwtProvider.createRefreshToken(gid); /* @@ -109,11 +109,11 @@ class AuthController { @RequestMapping(value = "/sign-out.do", method = RequestMethod.POST) public CtResponse signOut(HttpServletRequest request, HttpServletResponse response, - @RequestBody Map body, Authentication authentication) { + @RequestBody Map body) { logger.info("req: " + request.getRequestURI()); Long gid = _AG.toLong(body.get("gid")); - UserInfo userInfo = (UserInfo)authentication.getPrincipal(); + UserInfo userInfo = UserInfo.getCurr(); CtResponse result = new CtResponse(); if (gid != userInfo.getGid()) { @@ -156,11 +156,11 @@ class AuthController { } String user_id = (String)mapAccount.get("user_id"); - String nick_name = (String)mapAccount.get("user_id"); + String name = (String)mapAccount.get("user_id"); Long permission = (Long)mapAccount.get("permission"); Long biz_group_id = (Long)mapAccount.get("biz_group_id"); - //String newAccessToken = jwtProvider.createAccessToken(gid, user_id, nick_name, permission, biz_group_id); - String newAccessToken = jwtProvider.createAccessToken(gid, _AG.createUserInfoMap(user_id, nick_name, permission, biz_group_id)); + //String newAccessToken = jwtProvider.createAccessToken(gid, user_id, name, permission, biz_group_id); + String newAccessToken = jwtProvider.createAccessToken(gid, _AG.createUserInfoMap(user_id, name, permission, biz_group_id)); mapAccount.put("sval1", newAccessToken); diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/BizGroupController.java b/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/BizGroupController.java index 5a314e8..4183d26 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/BizGroupController.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/BizGroupController.java @@ -10,6 +10,8 @@ import org.springframework.web.bind.annotation.*; import com.handong.smartservice._AG; import com.handong.smartservice.component.CtResponse; import com.handong.smartservice.component.ErrorCode; +import com.handong.smartservice.component.Permission; +import com.handong.smartservice.component.UserInfo; import com.handong.smartservice.mapper.BizGroupMapper; import com.handong.smartservice.service.BizGroupService; @@ -68,6 +70,12 @@ class BizGroupController { public CtResponse addOrModifyBizGroup(boolean isModify, HttpServletRequest request, HttpServletResponse response, @RequestBody Map body) { CtResponse result = new CtResponse(); + UserInfo userInfo = UserInfo.getCurr(); + if (Permission.hasGroup(userInfo.getPermission()) == false) { + result.setErrCode(ErrorCode.PERMISSION_DENIED); + return result; + } + Long biz_group_id = _AG.toLong(body.get("biz_group_id")); Long pid = _AG.toLong(body.get("pid")); Long top_group_id = _AG.toLong(body.get("top_group_id")); @@ -116,10 +124,17 @@ class BizGroupController { @RequestMapping(value = "/remove-biz-group.do", method = RequestMethod.POST) public CtResponse removeBizGroup(HttpServletRequest request, HttpServletResponse response, @RequestBody Map body) { logger.info("req: " + request.getRequestURI()); - String ids = body.get("ids"); + + CtResponse result = new CtResponse(); - CtResponse result = bizGroupService.removeBizGroup(ids); - return result; + UserInfo userInfo = UserInfo.getCurr(); + if (Permission.hasGroup(userInfo.getPermission()) == false) { + result.setErrCode(ErrorCode.PERMISSION_DENIED); + return result; + } + + String ids = body.get("ids"); + return bizGroupService.removeBizGroup(ids); } diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/DeviceController.java b/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/DeviceController.java index 636a093..8b8cc78 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/DeviceController.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/DeviceController.java @@ -49,11 +49,13 @@ class DeviceController { Boolean is_group_access = _AG.toBoolean(body.get("is_group_access")); Long biz_group_id = _AG.toLong(body.get("biz_group_id")); - String name = body.get("name"); + String name = body.get("device_name"); + String uid1 = body.get("uid1"); + String conn_state = body.get("conn_state"); String date_start = body.get("date_start"); String date_end = body.get("date_end"); - Map mapResult = deviceService.getDeviceList(is_excel, offset, limit, is_group_access, biz_group_id, name, date_start, date_end); + Map mapResult = deviceService.getDeviceList(is_excel, offset, limit, is_group_access, biz_group_id, name, uid1, conn_state, date_start, date_end); if (is_excel) { List> list = (List>)mapResult.get("list"); diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/ErrorHistoryController.java b/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/ErrorHistoryController.java index e72577b..3620b85 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/ErrorHistoryController.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/ErrorHistoryController.java @@ -1,6 +1,7 @@ package com.handong.smartservice.controller.api; import com.handong.smartservice._AG; +import com.handong.smartservice.component.CtExcelMaker; import com.handong.smartservice.component.CtResponse; import com.handong.smartservice.component.ErrorCode; import com.handong.smartservice.service.ErrorHistoryService; @@ -13,6 +14,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.List; import java.util.Map; @@ -44,9 +46,20 @@ class ErrorHistoryController { String date_end = body.get("date_end"); String uid1 = body.get("uid1"); Long uid1_type = _AG.toLong(body.get("uid1_type")); - String slot = body.get("slot"); + String column_no = body.get("column_no"); - Map mapResult = errorHistoryService.getErrorHistoryList(is_excel, offset, limit, date_start, date_end, uid1, uid1_type, slot); + Map mapResult = errorHistoryService.getErrorHistoryList(is_excel, offset, limit, date_start, date_end, uid1, uid1_type, column_no); + + if (is_excel) { + List> list = (List>)mapResult.get("list"); + + String[] arrHeader = {"발생일시", "단말기 TID", "벤더", "컬럼번호"}; + String[] arrColumn = {"reg_time", "uid1", "uid1_type", "column_no"}; + + CtExcelMaker.makeExcelResponse(request, response, "기기에러내역", arrHeader, arrColumn, list, null); + return null; + } + result.put("result", mapResult); return result; } @@ -64,17 +77,17 @@ class ErrorHistoryController { return result; } - @RequestMapping(value = "/miss-slot.do", method = RequestMethod.POST) - public CtResponse missSlot(HttpServletRequest request, HttpServletResponse response, @RequestBody Map body) { + @RequestMapping(value = "/miss-column.do", method = RequestMethod.POST) + public CtResponse missColumn(HttpServletRequest request, HttpServletResponse response, @RequestBody Map body) { logger.info("req: " + request.getRequestURI()); CtResponse result = new CtResponse(); String uid1 = body.get("uid1"); Long uid1_type = _AG.toLong(body.get("uid1_type")); - String slot = body.get("slot"); + String column_no = body.get("column_no"); - Map mapResult = errorHistoryService.missSlot(uid1, uid1_type, slot); + Map mapResult = errorHistoryService.missColumn(uid1, uid1_type, column_no); result.put("result", mapResult); return result; } diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/GamderController.java b/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/GamderController.java new file mode 100644 index 0000000..4d02407 --- /dev/null +++ b/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/GamderController.java @@ -0,0 +1,148 @@ +package com.handong.smartservice.controller.api; + +import java.util.List; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.*; + +import com.handong.smartservice._AG; +import com.handong.smartservice.component.CtExcelMaker; +import com.handong.smartservice.component.CtResponse; +import com.handong.smartservice.service.GamderService; + +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + + +//TempCode - 겜더 화면 확인용. 응답은 GamderService의 하드코딩 데이터다. +@RestController +@RequestMapping("/api") +class GamderController { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + private final GamderService gamderService; + + + public GamderController(GamderService gamderService) { + this.gamderService = gamderService; + } + + + // 단말기 단가설정 ////////////////////////////////////////////////////////// + // + @RequestMapping(value = "/get-device-price.do", method = RequestMethod.POST) + public CtResponse getDevicePrice(HttpServletRequest request, HttpServletResponse response, @RequestBody Map body) { + logger.info("req: " + request.getRequestURI()); + + CtResponse result = new CtResponse(); + + Long device_id = _AG.toLong(body.get("device_id")); + + result.put("result", gamderService.getDevicePriceList(device_id)); + return result; + } + + // prices가 배열이라 Map로 받는다. + @RequestMapping(value = "/manage-device-price.do", method = RequestMethod.POST) + public CtResponse manageDevicePrice(HttpServletRequest request, HttpServletResponse response, @RequestBody Map body) { + logger.info("req: " + request.getRequestURI()); + + Object objDeviceId = body.get("device_id"); + Long device_id = _AG.toLong(objDeviceId == null ? "" : String.valueOf(objDeviceId)); + List prices = (List)body.get("prices"); + + return gamderService.manageDevicePrice(device_id, prices); + } + + @RequestMapping(value = "/pay-device-service.do", method = RequestMethod.POST) + public CtResponse payDeviceService(HttpServletRequest request, HttpServletResponse response, @RequestBody Map body) { + logger.info("req: " + request.getRequestURI()); + + Long device_id = _AG.toLong(body.get("device_id")); + Long service_pulse = _AG.toLong(body.get("service_pulse")); + String memo = _AG.safeStr(body.get("memo")); + + return gamderService.payDeviceService(device_id, service_pulse, memo); + } + + + // 경품 ////////////////////////////////////////////////////////////////// + // + @RequestMapping(value = "/get-prize.do", method = RequestMethod.POST) + public CtResponse getPrize(HttpServletRequest request, HttpServletResponse response, @RequestBody Map body) { + logger.info("req: " + request.getRequestURI()); + + CtResponse result = new CtResponse(); + + Boolean is_excel = _AG.toBoolean(body.get("is_excel")); + Long offset = _AG.toLong(body.get("offset")); + Long limit = _AG.toLong(body.get("limit")); + if (limit > 100) + limit = 100L; + + String device_name = body.get("device_name"); + String store_code = body.get("store_code"); + Long state = _AG.toLong(body.get("state")); + String date_start = body.get("date_start"); + String date_end = body.get("date_end"); + + Map mapResult = gamderService.getPrizeList(is_excel, offset, limit, device_name, store_code, state, date_start, date_end); + + if (is_excel) { + List> list = (List>)mapResult.get("list"); + + String[] arrHeader = {"당첨일시", "매장코드", "기기코드", "기기이름", "경품 출구", "단가 이름", "금액", "상태"}; + String[] arrColumn = {"reg_time", "store_code", "machine_code", "device_name", "exit_no", "price_name", "amount", "state"}; + + CtExcelMaker.makeExcelResponse(request, response, "경품당첨내역", arrHeader, arrColumn, list, null); + return null; + } + + result.put("result", mapResult); + return result; + } + + @RequestMapping(value = "/cancel-prize.do", method = RequestMethod.POST) + public CtResponse cancelPrize(HttpServletRequest request, HttpServletResponse response, @RequestBody Map body) { + logger.info("req: " + request.getRequestURI()); + + String prize_id = _AG.safeStr(body.get("prize_id")); + + return gamderService.cancelPrize(prize_id); + } + + + // 버튼 색상 ////////////////////////////////////////////////////////////// + // + @RequestMapping(value = "/get-button-color.do", method = RequestMethod.POST) + public CtResponse getButtonColor(HttpServletRequest request, HttpServletResponse response) { + logger.info("req: " + request.getRequestURI()); + + CtResponse result = new CtResponse(); + + result.put("result", gamderService.getButtonColorList()); + return result; + } + + // colors가 배열이라 Map로 받는다. + @RequestMapping(value = "/manage-button-color.do", method = RequestMethod.POST) + public CtResponse manageButtonColor(HttpServletRequest request, HttpServletResponse response, @RequestBody Map body) { + logger.info("req: " + request.getRequestURI()); + + List colors = (List)body.get("colors"); + + return gamderService.manageButtonColor(colors); + } + + @RequestMapping(value = "/apply-button-color.do", method = RequestMethod.POST) + public CtResponse applyButtonColor(HttpServletRequest request, HttpServletResponse response, @RequestBody Map body) { + logger.info("req: " + request.getRequestURI()); + + Long seq = _AG.toLong(body.get("seq")); + Long button_color = _AG.toLong(body.get("button_color")); + + return gamderService.applyButtonColor(seq, button_color); + } +} diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/GoodsController.java b/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/GoodsController.java index 6a6e04c..9118164 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/GoodsController.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/GoodsController.java @@ -129,7 +129,7 @@ class GoodsController { CtResponse result = new CtResponse(); Long device_id = _AG.toLong(body.get("device_id")); - String slot = body.get("slot"); + String column_no = body.get("column_no"); Long goods_id = _AG.toLong(body.get("goods_id")); if (device_id == 0) { @@ -137,7 +137,7 @@ class GoodsController { return result; } - Map mapResult = goodsService.getDeviceGoodsList(device_id, slot, goods_id); + Map mapResult = goodsService.getDeviceGoodsList(device_id, column_no, goods_id); result.put("result", mapResult); return result; } diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/SalesController.java b/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/SalesController.java index fee74d2..8bbac97 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/SalesController.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/SalesController.java @@ -51,13 +51,14 @@ class SalesController { String date_start = body.get("date_start"); String date_end = body.get("date_end"); Long biz_group_id = _AG.toLong(body.get("biz_group_id")); + Boolean query_uid1 = _AG.toBoolean(body.get("query_uid1")); String uid1 = body.get("uid1"); String device_name = body.get("device_name"); Long approval_type = _AG.toLong(body.get("approval_type")); Long date_type = _AG.toLong(body.get("date_type")); Map mapResult = salesService.getSalesList(is_excel, offset, limit, is_group_access, biz_group_id, date_start, date_end, - uid1, device_name, approval_type, date_type); + query_uid1, uid1, device_name, approval_type, date_type); if (is_excel) { List> list = (List>)mapResult.get("list"); diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/TerminalController.java b/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/TerminalController.java index e2386c3..9bb1b80 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/TerminalController.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/TerminalController.java @@ -11,6 +11,7 @@ import com.handong.smartservice._AG; import com.handong.smartservice.component.CtExcelMaker; import com.handong.smartservice.component.CtResponse; import com.handong.smartservice.component.ErrorCode; +import com.handong.smartservice.component.UserInfo; import com.handong.smartservice.service.TerminalService; import jakarta.servlet.http.HttpServletRequest; @@ -35,6 +36,19 @@ class TerminalController { this.terminalService = terminalService; } + @RequestMapping(value = "/list-uid1.do", method = RequestMethod.POST) + public CtResponse listUid1(HttpServletRequest request, HttpServletResponse response, @RequestBody(required = false) Map body) { + logger.info("req: " + request.getRequestURI()); + + CtResponse result = new CtResponse(); + + UserInfo userInfo = UserInfo.getCurr(); + Map mapResult = terminalService.listUid1(0L, 1000L, userInfo.getBizGroupId()); + + result.put("result", mapResult); + return result; + } + @RequestMapping(value = "/get-terminal.do", method = RequestMethod.POST) public CtResponse getTerminalList(HttpServletRequest request, HttpServletResponse response, @RequestBody Map body) { logger.info("req: " + request.getRequestURI()); diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/TransactionController.java b/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/TransactionController.java index 7cfbdc7..6ace343 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/TransactionController.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/controller/api/TransactionController.java @@ -52,6 +52,7 @@ class TransactionController { String date_start = body.get("date_start"); String date_end = body.get("date_end"); Long biz_group_id = _AG.toLong(body.get("biz_group_id")); + String device_name = body.get("device_name"); String uid1 = body.get("uid1"); Long uid1_type = _AG.toLong(body.get("uid1_type")); String type = body.get("type"); @@ -59,12 +60,12 @@ class TransactionController { String approval = body.get("approval"); String pay_name = body.get("pay_name"); String pay_vendor = body.get("pay_vendor"); - String slot = body.get("slot"); + String column_no = body.get("column_no"); String code = body.get("code"); String goods_name = body.get("goods_name"); Map mapResult = transactionService.getTransactionList(is_excel, offset, limit, is_group_access, biz_group_id, date_start, date_end, - uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, slot, code, goods_name); + device_name, uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, column_no, code, goods_name); if (is_excel) { List> list = (List>)mapResult.get("list"); @@ -74,7 +75,7 @@ class TransactionController { } String[] arrHeader = {"거래시간", "단말기 TID", "금액", "결제유형", "승인번호", "컬럼번호", "상품코드", "상품명", "결제서비스업체"}; - String[] arrColumn = {"order_time", "uid1", "amount", "type", "approval", "slot", "code", "goods_name", "pay_vendor"}; + String[] arrColumn = {"order_time", "uid1", "amount", "type", "approval", "column_no", "code", "goods_name", "pay_vendor"}; CtExcelMaker.makeExcelResponse(request, response, "거래내역목록", arrHeader, arrColumn, list, null); return null; @@ -105,12 +106,12 @@ class TransactionController { String approval = body.get("approval"); String pay_name = body.get("pay_name"); String pay_vendor = body.get("pay_vendor"); - String slot = body.get("slot"); + String column_no = body.get("column_no"); String code = body.get("code"); String goods_name = body.get("goods_name"); Map mapResult = transactionService.getUndefinedTransactionList(is_excel, offset, limit, date_start, date_end, - uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, slot, code, goods_name); + uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, column_no, code, goods_name); result.put("result", mapResult); return result; } @@ -130,7 +131,7 @@ class TransactionController { "approval": "33", "pay_name": " HANA", "pay_vendor": "HANA", - "slot": "01" + "column_no": "01" }' */ @@ -143,18 +144,18 @@ class TransactionController { String approval = body.get("approval"); String pay_name = body.get("pay_name"); String pay_vendor = body.get("pay_vendor"); - String slot = body.get("slot"); + String column_no = body.get("column_no"); //String code = body.get("code"); //String goods_name = body.get("goods_name"); String pay_unique_num = body.get("pay_unique_num"); String pay_order_time = body.get("pay_order_time"); - if (uid1 == null || uid1_type == null || type == null || amount == null || slot == null) { + if (uid1 == null || uid1_type == null || type == null || amount == null || column_no == null) { result.setErrCode(ErrorCode.INVALID_PARAMETER); return result; } - result = transactionService.addTransaction(uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, slot, pay_unique_num, pay_order_time); + result = transactionService.addTransaction(uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, column_no, pay_unique_num, pay_order_time); return result; } } diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/mapper/AccountMapper.java b/smartservice_backend/src/main/java/com/handong/smartservice/mapper/AccountMapper.java index 7ad977e..b75fb66 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/mapper/AccountMapper.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/mapper/AccountMapper.java @@ -10,14 +10,14 @@ import java.util.Map; public interface AccountMapper { List> selectAccount(Boolean isCount, Boolean is_excel, Long offset, Long limit, - String date_start, String date_end, Long gid, String user_id, String email, String nick_name, Long biz_group_id); + String date_start, String date_end, Long gid, String user_id, String email, String name, String phone, Long biz_group_id); List> selectAccount2(Boolean isCount, Long offset, Long limit, - String date_start, String date_end, Boolean is_excel, Long gid, String user_id, String email, String nick_name, Long biz_group_id); + String date_start, String date_end, Boolean is_excel, Long gid, String user_id, String email, String name, String phone, Long biz_group_id); int insertAccount(Map params); - int updateAccount(Long gid, String user_pw, String nick_name, String email, Long state, Long biz_group_id); + int updateAccount(Long gid, String user_pw, String name, String phone, String email, Long state, Long biz_group_id, Long permission); int changeState(List ids, int state); } diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/mapper/DeviceMapper.java b/smartservice_backend/src/main/java/com/handong/smartservice/mapper/DeviceMapper.java index 7c197b0..38d704a 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/mapper/DeviceMapper.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/mapper/DeviceMapper.java @@ -10,10 +10,10 @@ import java.util.Map; @Mapper public interface DeviceMapper { List> selectDevice(Boolean isCount, boolean is_excel, Long offset, Long limit, Boolean is_group_access, - Long biz_group_id, String name, String date_start, String date_end); + Long biz_group_id, String name, String uid1, String conn_state, String date_start, String date_end); List> selectDevice2(Boolean isCount, boolean is_excel, Long offset, Long limit, - Long biz_group_id, String name, String date_start, String date_end); + Long biz_group_id, String name, String uid1, String conn_state, String date_start, String date_end); Map selectDeviceById(Long device_id); diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/mapper/ErrorHistoryMapper.java b/smartservice_backend/src/main/java/com/handong/smartservice/mapper/ErrorHistoryMapper.java index bff416b..abde382 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/mapper/ErrorHistoryMapper.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/mapper/ErrorHistoryMapper.java @@ -9,9 +9,9 @@ import java.util.Map; @Mapper public interface ErrorHistoryMapper { List> selectErrorHistory(Boolean isCount, Boolean is_excel, Long offset, Long limit, - String date_start, String date_end, String uid1, Long uid1_type, String slot); + String date_start, String date_end, String uid1, Long uid1_type, String column_no); List> selectErrorHistoryByState(Long state); - int insertErrorHistory(String uid1, Long uid1_type, String slot); + int insertErrorHistory(String uid1, Long uid1_type, String column_no); } diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/mapper/GoodsMapper.java b/smartservice_backend/src/main/java/com/handong/smartservice/mapper/GoodsMapper.java index bb2250d..b4993b2 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/mapper/GoodsMapper.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/mapper/GoodsMapper.java @@ -16,7 +16,7 @@ public interface GoodsMapper { Map selectExistGoods(Long biz_group_id, String code, String name); - Map selectGoodsByUid1(String uid1, Long uid1_type, String slot); + Map selectGoodsByUid1(String uid1, Long uid1_type, String column_no); int insertGoods(Map params); @@ -25,10 +25,10 @@ public interface GoodsMapper { int deleteGoods(List ids); // - List> selectDeviceGoods(Long device_id, String slot, Long goods_id); + List> selectDeviceGoods(Long device_id, String column_no, Long goods_id); int insertDeviceGoods(Long device_id, List> device_goods); int updateDeviceGoodsPlusInventory(String approval); - int updateDeviceGoodsMinusInventory(Long device_id, String slot); + int updateDeviceGoodsMinusInventory(Long device_id, String column_no); int deleteDeviceGoods(Long device_id, List> device_goods); List> selectGoodsTemplateByBizGroupId(Long biz_group_id); diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/mapper/TerminalMapper.java b/smartservice_backend/src/main/java/com/handong/smartservice/mapper/TerminalMapper.java index f9f797e..d04f1b7 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/mapper/TerminalMapper.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/mapper/TerminalMapper.java @@ -10,6 +10,8 @@ import java.util.Map; @Mapper public interface TerminalMapper { + List> selectUid1(Long offset, Long limit, Long biz_group_id); + List> selectTerminal(Boolean isCount, Boolean is_excel, Long offset, Long limit, Boolean is_group_access, Long biz_group_id, String name, Long state, String date_start, String date_end); diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/mapper/TransactionMapper.java b/smartservice_backend/src/main/java/com/handong/smartservice/mapper/TransactionMapper.java index 60a764b..4c2542b 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/mapper/TransactionMapper.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/mapper/TransactionMapper.java @@ -1,7 +1,6 @@ package com.handong.smartservice.mapper; import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; @@ -10,18 +9,20 @@ import java.util.Map; public interface TransactionMapper { List> selectTransaction(Boolean isCount, Boolean is_excel, Long offset, Long limit, Boolean is_group_access, - Long biz_group_id, String date_start, String date_end, String uid1, Long uid1_type, String type, Long amount, - String approval, String pay_name, String pay_vendor, String slot, String code, String goods_name); + Long biz_group_id, String date_start, String date_end, String device_name, String uid1, Long uid1_type, String type, Long amount, + String approval, String pay_name, String pay_vendor, String column_no, String code, String goods_name); List> selectTransactionBizGroup0(Boolean isCount, Boolean is_excel, Long offset, Long limit, - String date_start, String date_end, String uid1, Long uid1_type, String type, Long amount, String approval, - String pay_name, String pay_vendor, String slot, String code, String goods_name); + String date_start, String date_end, String device_name, String uid1, Long uid1_type, String type, Long amount, String approval, + String pay_name, String pay_vendor, String column_no, String code, String goods_name); List> selectTransaction2(Boolean isCount, Boolean is_excel, Long offset, Long limit, Boolean is_group_access, Long biz_group_id, String date_start, String date_end, String uid1); List> selectTransaction3(Boolean isCount, Boolean is_excel, Long offset, Long limit, Boolean is_group_access, - Long biz_group_id, String date_start, String date_end, String uid1, String device_name, Long approval_type, Long date_type); + Long biz_group_id, String date_start, String date_end, Boolean query_uid1, String uid1, String device_name, Long approval_type, Long date_type); + + Map selectTransactionSum(Boolean is_group_access, Long biz_group_id, String date_start, String date_end); int insertTransaction(Map params); } diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/service/AccountService.java b/smartservice_backend/src/main/java/com/handong/smartservice/service/AccountService.java index d5ae1ca..ee61078 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/service/AccountService.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/service/AccountService.java @@ -1,5 +1,8 @@ package com.handong.smartservice.service; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -10,6 +13,7 @@ import com.handong.smartservice._AG; import com.handong.smartservice.component.CtResponse; import com.handong.smartservice.component.DbLogger; import com.handong.smartservice.component.ErrorCode; +import com.handong.smartservice.component.Permission; import com.handong.smartservice.component.UserInfo; import org.springframework.security.core.Authentication; @@ -22,6 +26,8 @@ import com.handong.smartservice.mapper.AccountMapper; @Service public class AccountService { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + private final AccountMapper accountMapper; private final PasswordEncoder passwordEncoder; @@ -38,7 +44,7 @@ public class AccountService { } List> listMap = (List>)accountMapper.selectAccount(false, false, 0L, 1L, - null, null, gid, user_id, null, null, 0L); + null, null, gid, user_id, null, null, null, 0L); if (listMap.size() == 0) result.put("result", null); @@ -48,26 +54,28 @@ public class AccountService { return result; } - public Map getAccountList(Long offset, Long limit, String date_start, String date_end, Boolean is_excel, Boolean is_group_access, String user_id, String email, String nick_name, Long biz_group_id) { + public Map getAccountList(Long offset, Long limit, String date_start, String date_end, Boolean is_excel, Boolean is_group_access, String user_id, String email, String name, String phone, Long biz_group_id) { Map mapResult = new HashMap<>(); //if (is_group_access) { List> listMap = (List>)accountMapper.selectAccount2(false, offset, limit, - date_start, date_end, is_excel, 0L, user_id, email, nick_name, biz_group_id); + date_start, date_end, is_excel, 0L, user_id, email, name, phone, biz_group_id); mapResult.put("list", listMap); Long totalCount = _AG.getNumberFromQuery("COUNT(*)", accountMapper.selectAccount2(true, offset, limit, - date_start, date_end, is_excel, 0L, user_id, email, nick_name, biz_group_id)); + date_start, date_end, is_excel, 0L, user_id, email, name, phone, biz_group_id)); mapResult.put("totalCount", totalCount); mapResult.put("offset", offset); return mapResult; } - public CtResponse addOrModifyAccount(boolean isModify, Long gid, String user_id, String user_pw, String email, String nick_name, Long state, Long biz_group_id, Long new_biz_group_id) { + public CtResponse addOrModifyAccount(boolean isModify, Long gid, String user_id, String user_pw, String email, String name, String phone,Long state, + Long biz_group_id, Long new_biz_group_id, Boolean perm_group, Boolean perm_uid1, Boolean perm_cancel) { CtResponse result = new CtResponse(); - UserInfo userInfo = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + //UserInfo userInfo = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + UserInfo userInfo = UserInfo.getCurr(); String enc_pw = passwordEncoder.encode(user_pw); @@ -80,8 +88,14 @@ public class AccountService { return result; } - //accountMapper.updateAccount(gid, user_pw, nick_name, email, state, biz_group_id); - accountMapper.updateAccount(gid, enc_pw, nick_name, email, state, biz_group_id); + Permission permission = new Permission(); + permission.setGroup(perm_group); + permission.setUid1(perm_uid1); + permission.setCancel(perm_cancel); + //logger.debug("[TRACE1], permission = {}", permission.get()); + + //accountMapper.updateAccount(gid, user_pw, name, email, state, biz_group_id); + accountMapper.updateAccount(gid, enc_pw, name, phone, email, state, biz_group_id, permission.get()); DbLogger.insert(2L, "계정정보 수정", userInfo.getGid()); } else { @@ -94,15 +108,21 @@ public class AccountService { params.put("user_id", user_id); //params.put("user_pw", user_pw); params.put("user_pw", enc_pw); - params.put("nick_name", nick_name); + params.put("name", name); + params.put("phone", phone); params.put("email", email); params.put("state", state); params.put("biz_group_id", biz_group_id); if (biz_group_id == 667) //TempCode - params.put("permission", 1L); - else - params.put("permission", 2L); + params.put("permission", Permission.PERM_ALL); + else { + Permission permission = new Permission(); + permission.setGroup(perm_group); + permission.setUid1(perm_uid1); + permission.setCancel(perm_cancel); + params.put("permission", permission.get()); + } if (accountMapper.insertAccount(params) == 0) { result.setErrCode(ErrorCode.INVALID_PARAMETER); diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/service/BizGroupService.java b/smartservice_backend/src/main/java/com/handong/smartservice/service/BizGroupService.java index a753758..87b153e 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/service/BizGroupService.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/service/BizGroupService.java @@ -20,7 +20,9 @@ import com.handong.smartservice._AG; import com.handong.smartservice.component.CtResponse; import com.handong.smartservice.component.DbLogger; import com.handong.smartservice.component.ErrorCode; +import com.handong.smartservice.component.Permission; import com.handong.smartservice.component.RcTreeBizGroup; +import com.handong.smartservice.component.UserInfo; import com.handong.smartservice.mapper.BizGroupMapper; import com.handong.smartservice.mapper.OperatingHistoryMapper; diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/service/DeviceService.java b/smartservice_backend/src/main/java/com/handong/smartservice/service/DeviceService.java index d76236f..5889265 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/service/DeviceService.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/service/DeviceService.java @@ -41,7 +41,8 @@ public class DeviceService { this.deviceMapper = deviceMapper; } - public Map getDeviceList(Boolean is_excel, Long offset, Long limit, Boolean is_group_access, Long biz_group_id, String name, String date_start, String date_end) { + public Map getDeviceList(Boolean is_excel, Long offset, Long limit, Boolean is_group_access, Long biz_group_id, + String name, String uid1, String conn_state, String date_start, String date_end) { Map mapResult = new HashMap<>(); //OldVer @@ -53,26 +54,27 @@ public class DeviceService { // biz_group_id = (Long)listForTopId.get(0).get("biz_group_id"); // } //} + if (is_group_access) { List> listMap = (List>)deviceMapper.selectDevice(false, is_excel, offset, limit, is_group_access, - biz_group_id, name, date_start, date_end); + biz_group_id, name, uid1, conn_state, date_start, date_end); mapResult.put("list", listMap); if (is_excel == false) { Long totalCount = _AG.getNumberFromQuery("COUNT(*)", deviceMapper.selectDevice(true, is_excel, offset, limit, is_group_access, - biz_group_id, name, date_start, date_end)); + biz_group_id, name, uid1, conn_state, date_start, date_end)); mapResult.put("totalCount", totalCount); mapResult.put("offset", offset); } } else { List> listMap = (List>)deviceMapper.selectDevice2(false, is_excel, offset, limit, - biz_group_id, name, date_start, date_end); + biz_group_id, name, uid1, conn_state, date_start, date_end); mapResult.put("list", listMap); if (is_excel == false) { Long totalCount = _AG.getNumberFromQuery("COUNT(*)", deviceMapper.selectDevice2(true, is_excel, offset, limit, - biz_group_id, name, date_start, date_end)); + biz_group_id, name, uid1, conn_state, date_start, date_end)); mapResult.put("totalCount", totalCount); mapResult.put("offset", offset); } @@ -84,7 +86,7 @@ public class DeviceService { public CtResponse addOrModifyDevice(boolean isModify, Long biz_group_id, Long new_biz_group_id, Long device_id, Long terminal_id, String name, String uid1, String manager_name) { CtResponse result = new CtResponse(); - UserInfo userInfo = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + UserInfo userInfo = UserInfo.getCurr(); if (isModify) { if (device_id == 0) { @@ -154,7 +156,7 @@ public class DeviceService { } DbLogger.insert(2L, "무인기기 추가, 기기명: " + name + "TID: " + uid1, userInfo.getGid()); - Long new_device_id = _AG.toLong((BigInteger)params.get("device_id")); + Long new_device_id = _AG.toLong((BigInteger)params.get("device_id")); if (deviceMapper.insertDeviceBizGroup(biz_group_id, new_device_id) == 0) { result.setErrCode(ErrorCode.INVALID_PARAMETER); @@ -172,7 +174,7 @@ public class DeviceService { public CtResponse removeDevice(Long biz_group_id, Long device_id) { CtResponse result = new CtResponse(); - UserInfo userInfo = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + UserInfo userInfo = UserInfo.getCurr(); //terminalMapper.updateTerminalRemoveDevice(device_id); Map mapTerminal = terminalMapper.selectTerminalByDeviceId(device_id); diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/service/ErrorHistoryService.java b/smartservice_backend/src/main/java/com/handong/smartservice/service/ErrorHistoryService.java index 693e497..64a784d 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/service/ErrorHistoryService.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/service/ErrorHistoryService.java @@ -10,8 +10,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -29,34 +33,73 @@ public class ErrorHistoryService { } public Map getErrorHistoryList(Boolean is_excel, Long offset, Long limit, String date_start, String date_end, - String uid1, Long uid1_type, String slot) { + String uid1, Long uid1_type, String column_no) { Map mapResult = new HashMap<>(); List> listMap = (List>)errorHistoryMapper.selectErrorHistory(false, is_excel, offset, limit, - date_start, date_end, uid1, uid1_type, slot); - mapResult.put("list", listMap); + date_start, date_end, uid1, uid1_type, column_no); Long totalCount = _AG.getNumberFromQuery("COUNT(*)", errorHistoryMapper.selectErrorHistory(true, is_excel, offset, limit, - date_start, date_end, uid1, uid1_type, slot)); + date_start, date_end, uid1, uid1_type, column_no)); + + //TempCode - 실제 데이터가 없을 때만 화면 확인용 하드코딩 데이터를 내려준다. 삭제해도 동작에 문제 없음. + if (listMap == null || listMap.isEmpty()) { + listMap = makeSampleErrorHistory(); + totalCount = (long)listMap.size(); + + int from = (int)Math.min(offset == null ? 0 : offset, listMap.size()); + int to = (int)Math.min(from + (limit == null ? 20 : limit), listMap.size()); + if (is_excel == false) + listMap = new ArrayList<>(listMap.subList(from, to)); + } + // + + mapResult.put("list", listMap); mapResult.put("totalCount", totalCount); mapResult.put("offset", offset); return mapResult; } + //TempCode - 화면 확인용 샘플. 프론트의 convertDateTime2()가 파싱하도록 ISO 형식으로 내려준다. + private static final DateTimeFormatter TEMP_DT = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"); + + private List> makeSampleErrorHistory() { + String[] arrUid1 = { "1234567", "1234568", "2345671", "2345672" }; + + List> list = new ArrayList<>(); + for (int i = 0; i < 27; i++) { + Map m = new LinkedHashMap<>(); + m.put("error_history_id", 5000 + i); + m.put("reg_time", LocalDateTime.now().minusMinutes(i * 53L + 7).format(TEMP_DT)); + m.put("uid1", arrUid1[i % arrUid1.length]); + m.put("uid1_type", (i % 2) + 1); + m.put("column_no", String.format("%02d", (i % 12) + 1)); + list.add(m); + } + + return list; + } + public Map getMiss(Long state) { Map mapResult = new HashMap<>(); List> listMap = errorHistoryMapper.selectErrorHistoryByState(1L); + + //TempCode - 실제 데이터가 없을 때만 화면 확인용 하드코딩 데이터를 내려준다. 삭제해도 동작에 문제 없음. + if (listMap == null || listMap.isEmpty()) + listMap = new ArrayList<>(makeSampleErrorHistory().subList(0, 6)); + // + mapResult.put("list", listMap); return mapResult; } - public CtResponse missSlot(String uid1, Long uid1_type, String slot) { + public CtResponse missColumn(String uid1, Long uid1_type, String column_no) { CtResponse result = new CtResponse(); - errorHistoryMapper.insertErrorHistory(uid1, uid1_type, slot); - DbLogger.insert(1L, "물품 미투출 TID: " + uid1 + ", 컬럼번호: " + slot, 2L); + errorHistoryMapper.insertErrorHistory(uid1, uid1_type, column_no); + DbLogger.insert(1L, "물품 미투출 TID: " + uid1 + ", 컬럼번호: " + column_no, 2L); return result; } diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/service/GamderService.java b/smartservice_backend/src/main/java/com/handong/smartservice/service/GamderService.java new file mode 100644 index 0000000..f53dc4c --- /dev/null +++ b/smartservice_backend/src/main/java/com/handong/smartservice/service/GamderService.java @@ -0,0 +1,210 @@ +package com.handong.smartservice.service; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import com.handong.smartservice.component.CtResponse; + + +//TempCode - 겜더 화면 확인용 하드코딩 데이터. DB 연동 시 이 클래스 전체를 실제 mapper 호출로 교체한다. +@Service +public class GamderService { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + private static final DateTimeFormatter DT = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"); + + // 프론트의 convertDateTime2()가 new Date(str)로 파싱하므로 ISO 형식으로 내려준다. + private static String ago(int minutes) { + return LocalDateTime.now().minusMinutes(minutes).format(DT); + } + + + // 단말기 단가설정 ////////////////////////////////////////////////////////// + // + private static Map price(int seq, int pay_type, int amount, int in_pulse, int out_pulse, + boolean use_service, int service_pulse, String price_name, int button_color, + int check_time, int pulse_interval) { + Map m = new LinkedHashMap<>(); + m.put("seq", seq); + m.put("pay_type", pay_type); + m.put("amount", amount); + m.put("in_pulse", in_pulse); + m.put("out_pulse", out_pulse); + m.put("use_service", use_service); + m.put("service_pulse", service_pulse); + m.put("price_name", price_name); + m.put("button_color", button_color); + m.put("check_time", check_time); + m.put("pulse_interval", pulse_interval); + return m; + } + + public Map getDevicePriceList(Long device_id) { + Map mapResult = new HashMap<>(); + + List> list = new ArrayList<>(); + // 코인(1) / 지폐(2) / 카드(3) + list.add(price(1, 1, 500, 1, 0, false, 0, "코인 500", 1, 0, 0)); + list.add(price(2, 1, 1000, 2, 0, false, 0, "코인 1000", 1, 0, 0)); + list.add(price(3, 2, 5000, 5, 0, true, 1, "지폐 5000", 1, 150, 80)); + list.add(price(4, 2, 10000, 10, 0, true, 2, "지폐 10000", 1, 150, 80)); + list.add(price(5, 3, 1000, 0, 2, false, 0, "카드 1000", 7, 0, 0)); + list.add(price(6, 3, 5000, 0, 10, true, 1, "카드 5000", 5, 0, 0)); + list.add(price(7, 3, 10000, 0, 20, true, 3, "카드 10000", 8, 200, 100)); + + mapResult.put("list", list); + return mapResult; + } + + public CtResponse manageDevicePrice(Long device_id, List prices) { + logger.info("manageDevicePrice, device_id: {}, count: {}", device_id, prices == null ? 0 : prices.size()); + return new CtResponse(); + } + + public CtResponse payDeviceService(Long device_id, Long service_pulse, String memo) { + logger.info("payDeviceService, device_id: {}, service_pulse: {}, memo: {}", device_id, service_pulse, memo); + return new CtResponse(); + } + + + // 경품 ////////////////////////////////////////////////////////////////// + // + private static final int PRIZE_STATE_WIN = 1; + private static final int PRIZE_STATE_CANCEL = 2; + + private static final String[] PRIZE_DEVICE_NAMES = { + "인형뽑기 1호기", "인형뽑기 2호기", "펀치머신", "레이싱 게임기", "농구 게임기", "메달 게임기", + }; + private static final String[] PRIZE_PRICE_NAMES = { + "카드 1000", "카드 5000", "지폐 5000", "코인 1000", + }; + + // 조회 조건과 무관하게 같은 목록을 만들어 두고 페이징만 적용한다. + private List> makePrizeList() { + List> list = new ArrayList<>(); + + for (int i = 0; i < 23; i++) { + Map m = new LinkedHashMap<>(); + m.put("prize_id", String.valueOf(1000 + i)); + m.put("reg_time", ago(i * 37 + 5)); + m.put("store_code", "0001"); + m.put("machine_code", String.format("%04d", (i % 6) + 1)); + m.put("device_name", PRIZE_DEVICE_NAMES[i % PRIZE_DEVICE_NAMES.length]); + m.put("exit_no", (i % 3) + 1); + m.put("price_name", PRIZE_PRICE_NAMES[i % PRIZE_PRICE_NAMES.length]); + m.put("amount", ((i % 5) + 1) * 1000); + // 5번째마다 취소 건을 섞어 상태 표시를 확인할 수 있게 한다. + m.put("state", (i % 5 == 4) ? PRIZE_STATE_CANCEL : PRIZE_STATE_WIN); + list.add(m); + } + + return list; + } + + public Map getPrizeList(Boolean is_excel, Long offset, Long limit, String device_name, + String store_code, Long state, String date_start, String date_end) { + Map mapResult = new HashMap<>(); + + List> all = makePrizeList(); + + // 상태 조건만 실제로 걸러준다. (나머지 조건은 하드코딩 데이터라 무시) + if (state != null && state != 0) { + List> filtered = new ArrayList<>(); + for (Map m : all) { + if (((Integer)m.get("state")).longValue() == state) + filtered.add(m); + } + all = filtered; + } + + long totalWin = 0, totalAmount = 0, cancelCount = 0, cancelAmount = 0; + for (Map m : all) { + int amount = (Integer)m.get("amount"); + if ((Integer)m.get("state") == PRIZE_STATE_CANCEL) { + cancelCount++; + cancelAmount += amount; + } + else { + totalWin++; + totalAmount += amount; + } + } + + Map sum = new LinkedHashMap<>(); + sum.put("total_count", totalWin); + sum.put("total_amount", totalAmount); + sum.put("cancel_count", cancelCount); + sum.put("net_amount", totalAmount - cancelAmount); + mapResult.put("sum", sum); + + // 엑셀은 페이징 없이 전체를 내린다. (기존 목록 API와 동일한 규칙) + List> list; + if (is_excel) { + list = all; + } + else { + int from = (int)Math.min(offset == null ? 0 : offset, all.size()); + int to = (int)Math.min(from + (limit == null ? 10 : limit), all.size()); + list = new ArrayList<>(all.subList(from, to)); + } + + mapResult.put("list", list); + mapResult.put("totalCount", (long)all.size()); + mapResult.put("offset", offset); + return mapResult; + } + + public CtResponse cancelPrize(String prize_id) { + logger.info("cancelPrize, prize_id: {}", prize_id); + return new CtResponse(); + } + + + // 버튼 색상 ////////////////////////////////////////////////////////////// + // + private static Map color(String value, String label, String color) { + Map m = new LinkedHashMap<>(); + m.put("value", value); + m.put("label", label); + m.put("color", color); + return m; + } + + public Map getButtonColorList() { + Map mapResult = new HashMap<>(); + + List> list = new ArrayList<>(); + list.add(color("1", "빨강", "#e02b20")); + list.add(color("2", "주황", "#f79009")); + list.add(color("3", "노랑", "#eaaa08")); + list.add(color("4", "연두", "#84cc16")); + list.add(color("5", "초록", "#12b76a")); + list.add(color("6", "청록", "#06aed4")); + list.add(color("7", "파랑", "#2e90fa")); + list.add(color("8", "남색", "#465fff")); + list.add(color("9", "보라", "#7a5af8")); + list.add(color("10", "분홍", "#ee46bc")); + + mapResult.put("list", list); + return mapResult; + } + + public CtResponse manageButtonColor(List colors) { + logger.info("manageButtonColor, count: {}", colors == null ? 0 : colors.size()); + return new CtResponse(); + } + + public CtResponse applyButtonColor(Long seq, Long button_color) { + logger.info("applyButtonColor, seq: {}, button_color: {}", seq, button_color); + return new CtResponse(); + } +} diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/service/GoodsService.java b/smartservice_backend/src/main/java/com/handong/smartservice/service/GoodsService.java index 537dc8e..3c3aa31 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/service/GoodsService.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/service/GoodsService.java @@ -68,7 +68,7 @@ public class GoodsService { public CtResponse addOrModifyGoods(boolean isModify, Long biz_group_id, Long goods_id, String code, String name, Long price, Long inventory, String vendor) { CtResponse result = new CtResponse(); - UserInfo userInfo = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + UserInfo userInfo = UserInfo.getCurr(); if (isModify) { if (goods_id == 0) { @@ -120,7 +120,7 @@ public class GoodsService { } // - public Map getDeviceGoodsList(Long device_id, String slot, Long goods_id) { + public Map getDeviceGoodsList(Long device_id, String column_no, Long goods_id) { Map mapResult = new HashMap<>(); Map mapDevice = deviceMapper.selectDeviceById(device_id); @@ -129,7 +129,7 @@ public class GoodsService { List> listMap = (List>)goodsMapper.selectGoodsByDevice(false, device_id); mapResult.put("goods_list", listMap); - List> listMap2 = (List>)goodsMapper.selectDeviceGoods(device_id, slot, goods_id); + List> listMap2 = (List>)goodsMapper.selectDeviceGoods(device_id, column_no, goods_id); mapResult.put("device_goods_list", listMap2); if (listMap.size() > 0) { @@ -143,7 +143,7 @@ public class GoodsService { public CtResponse addDeviceGoods(Long device_id, List> device_goods) { CtResponse result = new CtResponse(); - UserInfo userInfo = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + UserInfo userInfo = UserInfo.getCurr(); if (goodsMapper.insertDeviceGoods(device_id, device_goods) == 0) { result.setErrCode(ErrorCode.QUERY_ERROR); @@ -155,7 +155,7 @@ public class GoodsService { public CtResponse deleteDeviceGoods(Long device_id, List> device_goods) { CtResponse result = new CtResponse(); - UserInfo userInfo = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + UserInfo userInfo = UserInfo.getCurr(); //for (Map item : device_goods) { // item.put("device_id", device_id); @@ -192,7 +192,7 @@ public class GoodsService { Map element = new HashMap<>(); element.put("goods_template_element_id", item.get("goods_template_element_id")); - element.put("slot", item.get("slot")); + element.put("column_no", item.get("column_no")); element.put("goods_id", item.get("goods_id")); element.put("inventory", item.get("inventory")); element.put("idx", item.get("idx")); diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/service/SalesService.java b/smartservice_backend/src/main/java/com/handong/smartservice/service/SalesService.java index 8c058ea..7514697 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/service/SalesService.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/service/SalesService.java @@ -25,17 +25,23 @@ import com.handong.smartservice.mapper.GoodsMapper; public class SalesService { private final TransactionMapper transactionMapper; + /* private final BizGroupMapper bizGroupMapper; public SalesService(TransactionMapper transactionMapper, BizGroupMapper bizGroupMapper) { this.transactionMapper = transactionMapper; this.bizGroupMapper = bizGroupMapper; } + */ + public SalesService(TransactionMapper transactionMapper) { + this.transactionMapper = transactionMapper; + } public Map getSalesList(Boolean is_excel, Long offset, Long limit, Boolean is_group_access, Long biz_group_id, String date_start, String date_end, - String uid1, String device_name, Long approval_type, Long date_type) { + Boolean query_uid1, String uid1, String device_name, Long approval_type, Long date_type) { Map mapResult = new HashMap<>(); + /* if (is_group_access == false) { List> listForTopId = bizGroupMapper.selectBizGroup(biz_group_id, false, 0L, 1L, null, null, null, null, null, null, null); if (listForTopId != null && listForTopId.size() > 0) { @@ -44,13 +50,18 @@ public class SalesService { biz_group_id = (Long)listForTopId.get(0).get("biz_group_id"); } } + */ + + Map mapSum = (Map)transactionMapper.selectTransactionSum(is_group_access, + biz_group_id, date_start, date_end); + mapResult.put("sum", mapSum); List> listMap = (List>)transactionMapper.selectTransaction3(false, is_excel, offset, limit, is_group_access, - biz_group_id, date_start, date_end, uid1, device_name, approval_type, date_type); + biz_group_id, date_start, date_end, query_uid1, uid1, device_name, approval_type, date_type); mapResult.put("list", listMap); Long totalCount = _AG.getNumberFromQuery("COUNT(*)", transactionMapper.selectTransaction3(true, is_excel, offset, limit, is_group_access, - biz_group_id, date_start, date_end, uid1, device_name, approval_type, date_type)); + biz_group_id, date_start, date_end, query_uid1, uid1, device_name, approval_type, date_type)); mapResult.put("totalCount", totalCount); mapResult.put("offset", offset); return mapResult; diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/service/TerminalService.java b/smartservice_backend/src/main/java/com/handong/smartservice/service/TerminalService.java index 5cd0543..c951af0 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/service/TerminalService.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/service/TerminalService.java @@ -42,6 +42,15 @@ public class TerminalService { this.bizGroupMapper = bizGroupMapper; } + public Map listUid1(Long offset, Long limit, Long biz_group_id) { + Map mapResult = new HashMap<>(); + + List> listMap = (List>)terminalMapper.selectUid1(offset, limit, biz_group_id); + mapResult.put("list", listMap); + + return mapResult; + } + public Map getTerminalList(Boolean is_excel, Long offset, Long limit, Boolean is_group_access, Long biz_group_id, Long state, String date_start, String date_end) { Map mapResult = new HashMap<>(); diff --git a/smartservice_backend/src/main/java/com/handong/smartservice/service/TransactionService.java b/smartservice_backend/src/main/java/com/handong/smartservice/service/TransactionService.java index 66d4fd6..6830a3f 100644 --- a/smartservice_backend/src/main/java/com/handong/smartservice/service/TransactionService.java +++ b/smartservice_backend/src/main/java/com/handong/smartservice/service/TransactionService.java @@ -38,7 +38,7 @@ public class TransactionService { } public Map getTransactionList(Boolean is_excel, Long offset, Long limit, Boolean is_group_access, Long biz_group_id, String date_start, String date_end, - String uid1, Long uid1_type, String type, Long amount, String approval, String pay_name, String pay_vendor, String slot, String code, String goods_name) { + String device_name, String uid1, Long uid1_type, String type, Long amount, String approval, String pay_name, String pay_vendor, String column_no, String code, String goods_name) { Map mapResult = new HashMap<>(); /* @@ -53,32 +53,32 @@ public class TransactionService { */ List> listMap = (List>)transactionMapper.selectTransaction(false, is_excel, offset, limit, is_group_access, - biz_group_id, date_start, date_end, uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, slot, code, goods_name); + biz_group_id, date_start, date_end, device_name, uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, column_no, code, goods_name); mapResult.put("list", listMap); Long totalCount = _AG.getNumberFromQuery("COUNT(*)", transactionMapper.selectTransaction(true, is_excel, offset, limit, is_group_access, - biz_group_id, date_start, date_end, uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, slot, code, goods_name)); + biz_group_id, date_start, date_end, device_name, uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, column_no, code, goods_name)); mapResult.put("totalCount", totalCount); mapResult.put("offset", offset); return mapResult; } public Map getUndefinedTransactionList(Boolean is_excel, Long offset, Long limit, String date_start, String date_end, - String uid1, Long uid1_type, String type, Long amount, String approval, String pay_name, String pay_vendor, String slot, String code, String goods_name) { + String uid1, Long uid1_type, String type, Long amount, String approval, String pay_name, String pay_vendor, String column_no, String code, String goods_name) { Map mapResult = new HashMap<>(); List> listMap = (List>)transactionMapper.selectTransactionBizGroup0( - false, is_excel, offset, limit, date_start, date_end, uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, slot, code, goods_name); + false, is_excel, offset, limit, date_start, date_end, null, uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, column_no, code, goods_name); mapResult.put("list", listMap); Long totalCount = _AG.getNumberFromQuery("COUNT(*)", transactionMapper.selectTransactionBizGroup0( - true, is_excel, offset, limit, date_start, date_end, uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, slot, code, goods_name)); + true, is_excel, offset, limit, date_start, date_end, null, uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, column_no, code, goods_name)); mapResult.put("totalCount", totalCount); mapResult.put("offset", offset); return mapResult; } - public CtResponse addTransaction(String uid1, Long uid1_type, String type, Long amount, String approval, String pay_name, String pay_vendor, String slot, String pay_unique_num, String pay_order_time) { + public CtResponse addTransaction(String uid1, Long uid1_type, String type, Long amount, String approval, String pay_name, String pay_vendor, String column_no, String pay_unique_num, String pay_order_time) { CtResponse result = new CtResponse(); Long biz_group_id = 0L; Long device_id = 0L; @@ -99,8 +99,8 @@ public class TransactionService { } } - //select uid1, uid1_type -> device_id ->device_goods (slot) -> goods_id - Map goods = goodsMapper.selectGoodsByUid1(uid1, uid1_type, slot); + //select uid1, uid1_type -> device_id ->device_goods (column_no) -> goods_id + Map goods = goodsMapper.selectGoodsByUid1(uid1, uid1_type, column_no); if (goods != null) { device_id = (Long)goods.get("device_id"); } @@ -115,7 +115,7 @@ public class TransactionService { params.put("pay_unique_num", pay_unique_num); params.put("pay_name", pay_name); params.put("pay_vendor", pay_vendor); - params.put("slot", slot); + params.put("column_no", column_no); params.put("biz_group_id", biz_group_id); params.put("device_id", device_id); @@ -127,7 +127,7 @@ public class TransactionService { params.put("code", goods.get("code")); params.put("price", goods.get("price")); - goodsMapper.updateDeviceGoodsMinusInventory((Long)goods.get("device_id"), slot); + goodsMapper.updateDeviceGoodsMinusInventory((Long)goods.get("device_id"), column_no); } transactionMapper.insertTransaction(params); diff --git a/smartservice_backend/src/main/resources/mapper/AccountMapper.xml b/smartservice_backend/src/main/resources/mapper/AccountMapper.xml index c945194..e317891 100644 --- a/smartservice_backend/src/main/resources/mapper/AccountMapper.xml +++ b/smartservice_backend/src/main/resources/mapper/AccountMapper.xml @@ -6,37 +6,40 @@ @@ -61,35 +64,38 @@ ) SELECT - + COUNT(*) - AC.gid, AC.user_id, AC.reg_time, AC.user_pw, AC.biz_group_id, GT.name AS biz_group_name, AC.user_pw_time, AC.nick_name, AC.email, AC.state, AC.permission + AC.gid, AC.user_id, AC.reg_time, AC.user_pw, AC.biz_group_id, GT.name AS biz_group_name, AC.user_pw_time, AC.name, AC.phone, AC.email, AC.state, AC.permission FROM account AS AC JOIN group_tree GT ON GT.biz_group_id = AC.biz_group_id WHERE state != 2 - + AND #{date_start} <= DATE(AC.reg_time) - + AND DATE(AC.reg_time) <= #{date_end} - + AND AC.gid = #{gid} - + AND AC.user_id = #{user_id} - - AND AC.email like CONCAT(#{email}, '%') + + AND AC.email like CONCAT('%', #{email}, '%') - - AND AC.nick_name like CONCAT(#{nick_name}, '%') + + AND AC.name like CONCAT('%', #{name}, '%') - + + AND AC.phone like CONCAT(#{phone}, '%') + + ORDER BY gid DESC LIMIT #{limit} OFFSET #{offset} @@ -98,37 +104,41 @@ INSERT INTO account user_id, user_pw, - nick_name, - email, - state, - biz_group_id, - permission, + name, + phone, + email, + state, + biz_group_id, + permission, VALUES #{user_id}, #{user_pw}, - #{nick_name}, - #{email}, - #{state}, - #{biz_group_id}, - #{permission}, + #{name}, + #{phone}, + #{email}, + #{state}, + #{biz_group_id}, + #{permission}, UPDATE account - user_pw = #{user_pw}, - nick_name = #{nick_name}, - email = #{email}, - state = #{state}, - biz_group_id = #{biz_group_id}, + user_pw = #{user_pw}, + name = #{name}, + phone = #{phone}, + email = #{email}, + state = #{state}, + biz_group_id = #{biz_group_id}, + permission = #{permission} WHERE gid = #{gid} - + UPDATE account SET state=#{state} WHERE gid IN diff --git a/smartservice_backend/src/main/resources/mapper/BizGroupMapper.xml b/smartservice_backend/src/main/resources/mapper/BizGroupMapper.xml index 64db8b9..f5a95ac 100644 --- a/smartservice_backend/src/main/resources/mapper/BizGroupMapper.xml +++ b/smartservice_backend/src/main/resources/mapper/BizGroupMapper.xml @@ -6,7 +6,7 @@ @@ -48,7 +45,7 @@ SELECT biz_group_id FROM biz_group WHERE state != 2 AND biz_reg_num = #{biz_reg_num} - + AND biz_group_id != #{biz_group_id} LIMIT 1 @@ -77,38 +74,38 @@ INSERT INTO biz_group - + name, biz_reg_num, gid - , email - , phone - , ceo - , address + , email + , phone + , ceo + , address VALUES #{name}, #{biz_reg_num}, #{gid} - , #{email} - , #{phone} - , #{ceo} - , #{address} + , #{email} + , #{phone} + , #{ceo} + , #{address} top_group_id, pid, name, biz_reg_num, gid - , email - , phone - , ceo - , address + , email + , phone + , ceo + , address SELECT COALESCE(TGI.top_group_id, #{pid}) AS top_group_id, #{pid}, #{name}, #{biz_reg_num}, #{gid} - , #{email} - , #{phone} - , #{ceo} - , #{address} + , #{email} + , #{phone} + , #{ceo} + , #{address} FROM ( SELECT top_group_id FROM biz_group @@ -122,19 +119,19 @@ UPDATE biz_group - name = #{name}, - biz_reg_num = #{biz_reg_num}, - email = #{email}, - phone = #{phone}, - ceo = #{ceo}, - address = #{address}, - pid = #{pid}, + name = #{name}, + biz_reg_num = #{biz_reg_num}, + email = #{email}, + phone = #{phone}, + ceo = #{ceo}, + address = #{address}, + pid = #{pid}, WHERE biz_group_id = #{biz_group_id} - + UPDATE biz_group SET state = #{state} WHERE biz_group_id IN @@ -145,7 +142,7 @@ @@ -116,7 +125,7 @@ ) SELECT - + COUNT(*) @@ -128,16 +137,25 @@ JOIN group_tree GT ON DBG.biz_group_id = GT.biz_group_id LEFT JOIN terminal AS T ON T.device_id = D.device_id WHERE D.state != 2 - - AND D.name = #{name} + + AND D.name like CONCAT('%', #{name}, '%') - + + AND T.uid1 = #{uid1} + + + AND T.connect_time IS NOT NULL AND T.disconnect_time IS NOT NULL AND T.connect_time >= T.disconnect_time + + + AND T.connect_time IS NOT NULL AND T.disconnect_time IS NOT NULL AND T.connect_time < T.disconnect_time + + AND #{date_start} <= DATE(D.reg_time) - + AND DATE(D.reg_time) <= #{date_end} - + ORDER BY D.device_id DESC LIMIT #{limit} OFFSET #{offset} @@ -185,38 +203,35 @@ device_id, name, uid1 FROM device WHERE state != 2 - + AND device_id != #{device_id} - + AND name = #{name} LIMIT 1 - + INSERT INTO device name, gid, state, - manager_name, + manager_name, VALUES #{name}, #{gid}, #{state}, - #{manager_name}, + #{manager_name}, UPDATE device - name = #{name}, - uid1 = #{uid1}, - manager_name = #{manager_name}, - gid = #{gid}, + name = #{name}, + uid1 = #{uid1}, + manager_name = #{manager_name}, + gid = #{gid}, WHERE device_id = #{device_id} @@ -232,7 +247,7 @@ - + UPDATE device SET state = #{state} WHERE device_id IN @@ -244,7 +259,7 @@ + biz_group_id = #{biz_group_id}, + state = #{state}, + is_doc_accept = #{is_doc_accept}, + is_tid = #{is_tid}, + is_card = #{is_card}, + is_samchip = #{is_samchip}, + is_comm_open = #{is_comm_open}, + is_shipping = #{is_shipping}, + is_tested = #{is_tested}, + is_parcel = #{is_parcel}, + goods_list_id = #{goods_list_id}, + delivery_address = #{delivery_address}, + delivery_recv_name = #{delivery_recv_name}, + delivery_recv_phone = #{delivery_recv_phone}, + delivery_invoice_no = #{delivery_invoice_no}, + delivery_company = #{delivery_company}, + WHERE order_id = #{order_id} diff --git a/smartservice_backend/src/main/resources/mapper/ResourceBoardMapper.xml b/smartservice_backend/src/main/resources/mapper/ResourceBoardMapper.xml index 7f2b204..598c257 100644 --- a/smartservice_backend/src/main/resources/mapper/ResourceBoardMapper.xml +++ b/smartservice_backend/src/main/resources/mapper/ResourceBoardMapper.xml @@ -12,7 +12,7 @@ @@ -52,14 +52,14 @@ UPDATE resource_board - title = #{title}, - content = #{content}, + title = #{title}, + content = #{content}, WHERE resource_board_id = #{resource_board_id} - + UPDATE resource_board SET state = #{state} WHERE resource_board_id IN @@ -70,7 +70,7 @@ @@ -95,30 +98,31 @@ @@ -127,7 +131,7 @@ --> + + INSERT INTO transactions reg_time, process, - biz_group_id, - device_id, - uid1, - uid1_type, - order_time, - type, - amount, - approval, - pay_unique_num, - slot, - code, - goods_name, - price, - pay_name, - pay_vendor + biz_group_id, + device_id, + uid1, + uid1_type, + order_time, + type, + amount, + approval, + pay_unique_num, + column_no, + code, + goods_name, + price, + pay_name, + pay_vendor VALUES NOW(), 1, - #{biz_group_id}, - #{device_id}, - #{uid1}, - #{uid1_type}, - #{order_time}, - #{type}, - #{amount}, - #{approval}, - #{pay_unique_num}, - #{slot}, - #{code}, - #{goods_name}, - #{price}, - #{pay_name}, - #{pay_vendor} + #{biz_group_id}, + #{device_id}, + #{uid1}, + #{uid1_type}, + #{order_time}, + #{type}, + #{amount}, + #{approval}, + #{pay_unique_num}, + #{column_no}, + #{code}, + #{goods_name}, + #{price}, + #{pay_name}, + #{pay_vendor} \ No newline at end of file diff --git a/smartservice_backend/src/main/resources/mapper/VocMapper.xml b/smartservice_backend/src/main/resources/mapper/VocMapper.xml index 30a3844..02c4423 100644 --- a/smartservice_backend/src/main/resources/mapper/VocMapper.xml +++ b/smartservice_backend/src/main/resources/mapper/VocMapper.xml @@ -12,7 +12,7 @@ @@ -52,14 +52,14 @@ UPDATE voc - title = #{title}, - content = #{content}, + title = #{title}, + content = #{content}, WHERE voc_id = #{voc_id} - + UPDATE voc SET state = #{state} WHERE voc_id IN @@ -70,7 +70,7 @@