|
@@ -26,175 +26,229 @@ import javax.annotation.Resource;
|
|
|
|
|
|
/**
|
|
|
* Controller: tb_business -- 入境登记
|
|
|
- * @author qzy
|
|
|
+ *
|
|
|
+ * @author qzy
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/TbBusiness/")
|
|
|
public class TbBusinessController {
|
|
|
|
|
|
- /** 底层 Service 对象 */
|
|
|
- @Autowired
|
|
|
- TbBusinessService tbBusinessService;
|
|
|
- @Resource
|
|
|
- private TbBusinessItemService tbBusinessItemService;
|
|
|
- @Resource
|
|
|
+ /**
|
|
|
+ * 底层 Service 对象
|
|
|
+ */
|
|
|
+ @Autowired
|
|
|
+ TbBusinessService tbBusinessService;
|
|
|
+ @Resource
|
|
|
+ private TbBusinessItemService tbBusinessItemService;
|
|
|
+ @Resource
|
|
|
private TbPassRecordService tbPassRecordService;
|
|
|
|
|
|
- /** 增 */
|
|
|
- @RequestMapping("add")
|
|
|
- @SaCheckPermission(TbBusiness.PERMISSION_CODE)
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public AjaxJson add(TbBusiness t){
|
|
|
- return tbBusinessService.addOrUpdate(t);
|
|
|
- }
|
|
|
-
|
|
|
- /** 删 */
|
|
|
- @RequestMapping("delete")
|
|
|
- @SaCheckPermission(TbBusiness.PERMISSION_INPUT)
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public AjaxJson delete(String id){
|
|
|
- tbBusinessService.removeById(id);
|
|
|
- tbBusinessItemService.removeByBusinessId(id);
|
|
|
- return AjaxJson.getSuccess();
|
|
|
- }
|
|
|
-
|
|
|
- /** 删 - 根据id列表 */
|
|
|
- @RequestMapping("deleteByIds")
|
|
|
- @SaCheckPermission(TbBusiness.PERMISSION_CODE)
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public AjaxJson deleteByIds(){
|
|
|
- List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
|
|
|
- ids.forEach(id->{
|
|
|
- tbBusinessItemService.removeByBusinessId(id+"");
|
|
|
- });
|
|
|
- int line = SP.publicMapper.deleteByIds(TbBusiness.TABLE_NAME, ids);
|
|
|
- return AjaxJson.getByLine(line);
|
|
|
- }
|
|
|
-
|
|
|
- /** 改 */
|
|
|
- @RequestMapping("update")
|
|
|
- @SaCheckPermission(TbBusiness.PERMISSION_CODE)
|
|
|
- public AjaxJson update(TbBusiness t){
|
|
|
- tbBusinessService.addOrUpdate(t);
|
|
|
- return AjaxJson.getSuccess();
|
|
|
- }
|
|
|
- /** 确认业务 */
|
|
|
- @RequestMapping("confirm")
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public AjaxJson confirm(){
|
|
|
- if (!StpUtil.hasPermissionAnd(TbBusiness.PERMISSION_CONFIRM)&&!
|
|
|
- StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
|
|
|
- return AjaxJson.getError("无确认业务权限");
|
|
|
- }
|
|
|
- SoMap so = SoMap.getRequestSoMap();
|
|
|
- List<String>ids=so.getListByComma("ids",String.class);
|
|
|
- tbBusinessService.confirm(ids);
|
|
|
- return AjaxJson.getSuccess();
|
|
|
- }
|
|
|
- /** 确认业务 */
|
|
|
- @RequestMapping("adminConfirmPay")
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public AjaxJson adminConfirmPay(){
|
|
|
- if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
|
|
|
- return AjaxJson.getError("无确认支付权限");
|
|
|
- }
|
|
|
- SoMap so = SoMap.getRequestSoMap();
|
|
|
- List<String>ids=so.getListByComma("ids",String.class);
|
|
|
- String ticket=so.getString("payTicket");
|
|
|
- tbBusinessService.adminConfirmPay(ids,ticket);
|
|
|
- return AjaxJson.getSuccess();
|
|
|
- }
|
|
|
-
|
|
|
- /** 手动入场确认 */
|
|
|
- @RequestMapping("adminConfirmIn")
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public AjaxJson adminConfirmIn(){
|
|
|
- if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
|
|
|
- return AjaxJson.getError("无确认入场权限");
|
|
|
- }
|
|
|
- SoMap so = SoMap.getRequestSoMap();
|
|
|
- String id=so.getString("id");
|
|
|
- String inChannel=so.getString("inChannel");
|
|
|
- tbBusinessService.adminConfirmIn(id,inChannel);
|
|
|
- return AjaxJson.getSuccess();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /** 查 - 根据id */
|
|
|
- @RequestMapping("getById")
|
|
|
- public AjaxJson getById(String id){
|
|
|
- TbBusiness t = tbBusinessService.getById(id);
|
|
|
- List<TbBusinessItem>items=tbBusinessItemService.findByBusinessId(id);
|
|
|
- t.setItems(items);
|
|
|
- return AjaxJson.getSuccessData(t);
|
|
|
- }
|
|
|
-
|
|
|
- /** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
|
|
|
- @RequestMapping("getList")
|
|
|
- public AjaxJson getList() {
|
|
|
- SoMap so = SoMap.getRequestSoMap();
|
|
|
- String currentCustomerId=StpUserUtil.getCustomerId();
|
|
|
- if (!currentCustomerId.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
|
|
|
- so.put("customerId",currentCustomerId);
|
|
|
- }
|
|
|
- List<TbBusiness> list = tbBusinessService.getList(so.startPage());
|
|
|
- return AjaxJson.getPageData(so.getDataCount(), list);
|
|
|
- }
|
|
|
-
|
|
|
- /** 改 */
|
|
|
- @RequestMapping("pay")
|
|
|
- public AjaxJson pay(){
|
|
|
- if (!StpUtil.hasPermissionAnd("tb-business-pay")&&!
|
|
|
- StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
|
|
|
- return AjaxJson.getError("无支付权限");
|
|
|
- }
|
|
|
- SoMap so = SoMap.getRequestSoMap();
|
|
|
- String id=so.getString("id");
|
|
|
- String payTicket=so.getString("payTicket");
|
|
|
- tbBusinessService.pay(id,payTicket);
|
|
|
- return AjaxJson.getSuccess();
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping("adminSetIn")
|
|
|
- public AjaxJson adminSetIn(){
|
|
|
- if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
|
|
|
- return AjaxJson.getError("无入场权限");
|
|
|
- }
|
|
|
- SoMap so = SoMap.getRequestSoMap();
|
|
|
- String id=so.getString("id");
|
|
|
- Date inTime=so.getDateTime("realInTime");
|
|
|
- TbBusiness tbBusiness=tbBusinessService.getById(id);
|
|
|
- tbBusiness.setRealInTime(inTime).setInChannel(so.getString("inChannel"));
|
|
|
- tbBusinessService.updateById(tbBusiness);
|
|
|
+ /**
|
|
|
+ * 增
|
|
|
+ */
|
|
|
+ @RequestMapping("add")
|
|
|
+ @SaCheckPermission(TbBusiness.PERMISSION_CODE)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public AjaxJson add(TbBusiness t) {
|
|
|
+ return tbBusinessService.addOrUpdate(t);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删
|
|
|
+ */
|
|
|
+ @RequestMapping("delete")
|
|
|
+ @SaCheckPermission(TbBusiness.PERMISSION_INPUT)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public AjaxJson delete(String id) {
|
|
|
+ tbBusinessService.removeById(id);
|
|
|
+ tbBusinessItemService.removeByBusinessId(id);
|
|
|
+ return AjaxJson.getSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删 - 根据id列表
|
|
|
+ */
|
|
|
+ @RequestMapping("deleteByIds")
|
|
|
+ @SaCheckPermission(TbBusiness.PERMISSION_CODE)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public AjaxJson deleteByIds() {
|
|
|
+ List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
|
|
|
+ ids.forEach(id -> {
|
|
|
+ tbBusinessItemService.removeByBusinessId(id + "");
|
|
|
+ });
|
|
|
+ int line = SP.publicMapper.deleteByIds(TbBusiness.TABLE_NAME, ids);
|
|
|
+ return AjaxJson.getByLine(line);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 改
|
|
|
+ */
|
|
|
+ @RequestMapping("update")
|
|
|
+ @SaCheckPermission(TbBusiness.PERMISSION_CODE)
|
|
|
+ public AjaxJson update(TbBusiness t) {
|
|
|
+ tbBusinessService.addOrUpdate(t);
|
|
|
+ return AjaxJson.getSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 确认业务
|
|
|
+ */
|
|
|
+ @RequestMapping("confirm")
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public AjaxJson confirm() {
|
|
|
+ if (!StpUtil.hasPermissionAnd(TbBusiness.PERMISSION_CONFIRM) && !
|
|
|
+ StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
|
|
|
+ return AjaxJson.getError("无确认业务权限");
|
|
|
+ }
|
|
|
+ SoMap so = SoMap.getRequestSoMap();
|
|
|
+ List<String> ids = so.getListByComma("ids", String.class);
|
|
|
+ tbBusinessService.confirm(ids);
|
|
|
+ return AjaxJson.getSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 确认业务
|
|
|
+ */
|
|
|
+ @RequestMapping("adminConfirmPay")
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public AjaxJson adminConfirmPay() {
|
|
|
+ if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
|
|
|
+ return AjaxJson.getError("无确认支付权限");
|
|
|
+ }
|
|
|
+ SoMap so = SoMap.getRequestSoMap();
|
|
|
+ List<String> ids = so.getListByComma("ids", String.class);
|
|
|
+ String ticket = so.getString("payTicket");
|
|
|
+ tbBusinessService.adminConfirmPay(ids, ticket);
|
|
|
+ return AjaxJson.getSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 手动入场确认
|
|
|
+ */
|
|
|
+ @RequestMapping("adminConfirmIn")
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public AjaxJson adminConfirmIn() {
|
|
|
+ if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
|
|
|
+ return AjaxJson.getError("无确认入场权限");
|
|
|
+ }
|
|
|
+ SoMap so = SoMap.getRequestSoMap();
|
|
|
+ String id = so.getString("id");
|
|
|
+ String inChannel = so.getString("inChannel");
|
|
|
+ tbBusinessService.adminConfirmIn(id, inChannel);
|
|
|
+ return AjaxJson.getSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查 - 根据id
|
|
|
+ */
|
|
|
+ @RequestMapping("getById")
|
|
|
+ public AjaxJson getById(String id) {
|
|
|
+ TbBusiness t = tbBusinessService.getById(id);
|
|
|
+ List<TbBusinessItem> items = tbBusinessItemService.findByBusinessId(id);
|
|
|
+ t.setItems(items);
|
|
|
+ return AjaxJson.getSuccessData(t);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查集合 - 根据条件(参数为空时代表忽略指定条件)
|
|
|
+ */
|
|
|
+ @RequestMapping("getList")
|
|
|
+ public AjaxJson getList() {
|
|
|
+ SoMap so = SoMap.getRequestSoMap();
|
|
|
+ String currentCustomerId = StpUserUtil.getCustomerId();
|
|
|
+ if (!currentCustomerId.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
|
|
|
+ so.put("customerId", currentCustomerId);
|
|
|
+ }
|
|
|
+ List<TbBusiness> list = tbBusinessService.getList(so.startPage());
|
|
|
+ return AjaxJson.getPageData(so.getDataCount(), list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 改
|
|
|
+ */
|
|
|
+ @RequestMapping("pay")
|
|
|
+ public AjaxJson pay() {
|
|
|
+ if (!StpUtil.hasPermissionAnd("tb-business-pay") && !
|
|
|
+ StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
|
|
|
+ return AjaxJson.getError("无支付权限");
|
|
|
+ }
|
|
|
+ SoMap so = SoMap.getRequestSoMap();
|
|
|
+ String id = so.getString("id");
|
|
|
+ String payTicket = so.getString("payTicket");
|
|
|
+ tbBusinessService.pay(id, payTicket);
|
|
|
+ return AjaxJson.getSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("adminSetIn")
|
|
|
+ public AjaxJson adminSetIn() {
|
|
|
+ if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
|
|
|
+ return AjaxJson.getError("无入场权限");
|
|
|
+ }
|
|
|
+ SoMap so = SoMap.getRequestSoMap();
|
|
|
+ String id = so.getString("id");
|
|
|
+ Date inTime = so.getDateTime("realInTime");
|
|
|
+ Date chinaCarInTime = so.getDateTime("chinaCarInTime");
|
|
|
+ TbBusiness tbBusiness = tbBusinessService.getById(id);
|
|
|
+ tbBusiness.setChinaCarInTime(chinaCarInTime).setRealInTime(inTime);
|
|
|
+ tbBusinessService.updateById(tbBusiness);
|
|
|
|
|
|
//更新放行记录
|
|
|
TbPassRecord record = tbPassRecordService.getByBusinessId(tbBusiness.getId());
|
|
|
record.setStatus(2).setInTime(tbBusiness.getRealInTime()).setUpdateTime(new Date());
|
|
|
tbPassRecordService.saveOrUpdate(record);
|
|
|
|
|
|
- return AjaxJson.getSuccess();
|
|
|
- }
|
|
|
- @RequestMapping("adminOut")
|
|
|
- public AjaxJson adminOut()throws Exception{
|
|
|
- if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
|
|
|
- return AjaxJson.getError("无离场权限");
|
|
|
- }
|
|
|
- SoMap so = SoMap.getRequestSoMap();
|
|
|
- String id=so.getString("id");
|
|
|
- tbBusinessService.adminOut(id,so.getDateTime("outDayTime"),so.getString("outChannel"));
|
|
|
- return AjaxJson.getSuccess();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // ------------------------- 前端接口 -------------------------
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ return AjaxJson.getSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("adminOut")
|
|
|
+ public AjaxJson adminOut(){
|
|
|
+ if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
|
|
|
+ return AjaxJson.getError("无离场权限");
|
|
|
+ }
|
|
|
+ SoMap so = SoMap.getRequestSoMap();
|
|
|
+ String id = so.getString("id");
|
|
|
+ TbBusiness business= tbBusinessService.getById(id);
|
|
|
+ Date outTime=so.getDateTime("outDayTime");
|
|
|
+ Date chinaCarOutTime=so.getDateTime("chinaCarOutTime");
|
|
|
+ business.setOutDayTime(outTime);
|
|
|
+ tbBusinessService. calculationPartMoney("越南车",business);
|
|
|
+ tbBusinessService.updateById(business);
|
|
|
+ business.setChinaCarOutTime(chinaCarOutTime);
|
|
|
+ tbBusinessService. calculationPartMoney("中国车",business);
|
|
|
+ tbBusinessService.updateById(business);
|
|
|
+ return AjaxJson.getSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("calJwPartMoney")
|
|
|
+ public AjaxJson calJwPartMoney(TbBusiness business) {
|
|
|
+ if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
|
|
|
+ return AjaxJson.getError("无生成账单权限");
|
|
|
+ }
|
|
|
+ tbBusinessService.calculationPartMoney("越南车", business);
|
|
|
+ return AjaxJson.getSuccessData(business);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("calChinaPartMoney")
|
|
|
+ public AjaxJson calChinaPartMoney(TbBusiness business) {
|
|
|
+ if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
|
|
|
+ return AjaxJson.getError("无生成账单权限");
|
|
|
+ }
|
|
|
+ tbBusinessService.calculationPartMoney("中国车", business);
|
|
|
+ return AjaxJson.getSuccessData(business);
|
|
|
+ }
|
|
|
+ @RequestMapping("complete")
|
|
|
+ public AjaxJson complete(TbBusiness business) {
|
|
|
+ if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
|
|
|
+ return AjaxJson.getError("无生成账单权限");
|
|
|
+ }
|
|
|
+ business.setComplete(1);
|
|
|
+ tbBusinessService.updateById(business);
|
|
|
+ return AjaxJson.getSuccessData(business);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // ------------------------- 前端接口 -------------------------
|
|
|
+
|
|
|
|
|
|
}
|