|
|
@@ -2,13 +2,19 @@ package com.dk.mdm.service.mst;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.dk.common.infrastructure.constant.Constant;
|
|
|
+import com.dk.common.infrastructure.enums.ErrorCodeEnum;
|
|
|
import com.dk.common.model.pojo.PageList;
|
|
|
+import com.dk.common.response.ResponseCodeEnum;
|
|
|
import com.dk.common.response.ResponseResultUtil;
|
|
|
import com.dk.common.response.ResponseResultVO;
|
|
|
import com.dk.mdm.model.pojo.mst.PrintLayout;
|
|
|
import com.dk.mdm.mapper.mst.PrintLayoutMapper;
|
|
|
import com.dk.common.service.BaseService;
|
|
|
import com.dk.common.mapper.BaseMapper;
|
|
|
+import com.dk.mdm.model.pojo.mst.Role;
|
|
|
+import com.dk.mdm.model.vo.mst.RoleVo;
|
|
|
+import com.dk.mdm.service.common.CommonService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -35,6 +41,9 @@ public class PrintLayoutService extends BaseService<PrintLayout> {
|
|
|
@Autowired
|
|
|
private PrintLayoutMapper printLayoutMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CommonService commonService;
|
|
|
+
|
|
|
/**
|
|
|
* @desc : 获取打印数据
|
|
|
* @author : 周兴
|
|
|
@@ -45,4 +54,48 @@ public class PrintLayoutService extends BaseService<PrintLayout> {
|
|
|
JSONObject obj = JSONObject.parseObject(map.get("f_get_print_data").toString());
|
|
|
return ResponseResultUtil.success(obj.get("data"));
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 新建票据
|
|
|
+ * @author : 周兴
|
|
|
+ * @date : 2024/4/23 8:38
|
|
|
+ */
|
|
|
+ @Transactional(
|
|
|
+ rollbackFor = {Exception.class}
|
|
|
+ )
|
|
|
+ public ResponseResultVO<?> insert(PrintLayout printLayout) {
|
|
|
+ // 判断票据名称是否重复
|
|
|
+ Long count = printLayoutMapper.selectByName(printLayout);
|
|
|
+ if(count > 0){
|
|
|
+ return ResponseResultUtil.error(ErrorCodeEnum.LAYOUT_NAME_EXISTS.getCode(),
|
|
|
+ ErrorCodeEnum.LAYOUT_NAME_EXISTS.getMessage());
|
|
|
+ }
|
|
|
+ // 获取显示顺序
|
|
|
+ Integer displayNo =commonService.getMaxDisplayNo(Constant.DisplayNoTable.PRINT_LAYOUT);
|
|
|
+ printLayout.setDisplayNo(displayNo);
|
|
|
+ //新建
|
|
|
+ super.insert(printLayout);
|
|
|
+ return ResponseResultUtil.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 更新票据
|
|
|
+ * @author : 周兴
|
|
|
+ * @date : 2024/4/23 8:38
|
|
|
+ */
|
|
|
+ @Transactional(
|
|
|
+ rollbackFor = {Exception.class}
|
|
|
+ )
|
|
|
+ public ResponseResultVO<Boolean> update(PrintLayout printLayout) {
|
|
|
+ // 判断票据名称是否重复
|
|
|
+ Long count = printLayoutMapper.selectByName(printLayout);
|
|
|
+ if(count > 0){
|
|
|
+ return ResponseResultUtil.error(ErrorCodeEnum.LAYOUT_NAME_EXISTS.getCode(),
|
|
|
+ ErrorCodeEnum.LAYOUT_NAME_EXISTS.getMessage());
|
|
|
+ }
|
|
|
+ // 更新
|
|
|
+ super.updateByUuid(printLayout);
|
|
|
+ return ResponseResultUtil.success();
|
|
|
+ }
|
|
|
+
|
|
|
}
|