|
@@ -1,5 +1,6 @@
|
|
|
package com.pj.project.tb_invoice_info;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
@@ -20,126 +21,142 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
|
|
|
/**
|
|
|
* Controller: tb_invoice_info -- 开票信息表
|
|
|
- * @author lzm
|
|
|
+ *
|
|
|
+ * @author lzm
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/TbInvoiceInfo/")
|
|
|
public class TbInvoiceInfoController {
|
|
|
|
|
|
- /** 底层 Service 对象 */
|
|
|
- @Autowired
|
|
|
- TbInvoiceInfoService tbInvoiceInfoService;
|
|
|
-
|
|
|
- /** 增 */
|
|
|
- @RequestMapping("add")
|
|
|
- @SaCheckPermission(TbInvoiceInfo.PERMISSION_CODE)
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public AjaxJson add(TbInvoiceInfo t){
|
|
|
- tbInvoiceInfoService.add(t);
|
|
|
- t = tbInvoiceInfoService.getById(SP.publicMapper.getPrimarykey());
|
|
|
- return AjaxJson.getSuccessData(t);
|
|
|
- }
|
|
|
-
|
|
|
- /** 删 */
|
|
|
- @RequestMapping("delete")
|
|
|
- @SaCheckPermission(TbInvoiceInfo.PERMISSION_CODE)
|
|
|
- public AjaxJson delete(Long id){
|
|
|
- int line = tbInvoiceInfoService.delete(id);
|
|
|
- return AjaxJson.getByLine(line);
|
|
|
- }
|
|
|
-
|
|
|
- /** 删 - 根据id列表 */
|
|
|
- @RequestMapping("deleteByIds")
|
|
|
- @SaCheckPermission(TbInvoiceInfo.PERMISSION_CODE)
|
|
|
- public AjaxJson deleteByIds(){
|
|
|
- List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
|
|
|
- int line = SP.publicMapper.deleteByIds(TbInvoiceInfo.TABLE_NAME, ids);
|
|
|
- return AjaxJson.getByLine(line);
|
|
|
- }
|
|
|
-
|
|
|
- /** 改 */
|
|
|
- @RequestMapping("update")
|
|
|
- @SaCheckPermission(TbInvoiceInfo.PERMISSION_CODE)
|
|
|
- public AjaxJson update(TbInvoiceInfo t){
|
|
|
- int line = tbInvoiceInfoService.update(t);
|
|
|
- return AjaxJson.getByLine(line);
|
|
|
- }
|
|
|
-
|
|
|
- /** 查 - 根据id */
|
|
|
- @RequestMapping("getById")
|
|
|
- public AjaxJson getById(Long id){
|
|
|
- TbInvoiceInfo t = tbInvoiceInfoService.getById(id);
|
|
|
- return AjaxJson.getSuccessData(t);
|
|
|
- }
|
|
|
-
|
|
|
- /** 查 - 根据id */
|
|
|
+ /**
|
|
|
+ * 底层 Service 对象
|
|
|
+ */
|
|
|
+ @Autowired
|
|
|
+ TbInvoiceInfoService tbInvoiceInfoService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 增
|
|
|
+ */
|
|
|
+ @RequestMapping("add")
|
|
|
+ @SaCheckPermission(TbInvoiceInfo.PERMISSION_CODE)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public AjaxJson add(TbInvoiceInfo t) {
|
|
|
+ tbInvoiceInfoService.add(t);
|
|
|
+ t = tbInvoiceInfoService.getById(SP.publicMapper.getPrimarykey());
|
|
|
+ return AjaxJson.getSuccessData(t);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删
|
|
|
+ */
|
|
|
+ @RequestMapping("delete")
|
|
|
+ @SaCheckPermission(TbInvoiceInfo.PERMISSION_CODE)
|
|
|
+ public AjaxJson delete(Long id) {
|
|
|
+ int line = tbInvoiceInfoService.delete(id);
|
|
|
+ return AjaxJson.getByLine(line);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删 - 根据id列表
|
|
|
+ */
|
|
|
+ @RequestMapping("deleteByIds")
|
|
|
+ @SaCheckPermission(TbInvoiceInfo.PERMISSION_CODE)
|
|
|
+ public AjaxJson deleteByIds() {
|
|
|
+ List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
|
|
|
+ int line = SP.publicMapper.deleteByIds(TbInvoiceInfo.TABLE_NAME, ids);
|
|
|
+ return AjaxJson.getByLine(line);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 改
|
|
|
+ */
|
|
|
+ @RequestMapping("update")
|
|
|
+ @SaCheckPermission(TbInvoiceInfo.PERMISSION_CODE)
|
|
|
+ public AjaxJson update(TbInvoiceInfo t) {
|
|
|
+ int line = tbInvoiceInfoService.update(t);
|
|
|
+ return AjaxJson.getByLine(line);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查 - 根据id
|
|
|
+ */
|
|
|
+ @RequestMapping("getById")
|
|
|
+ public AjaxJson getById(Long id) {
|
|
|
+ TbInvoiceInfo t = tbInvoiceInfoService.getById(id);
|
|
|
+ return AjaxJson.getSuccessData(t);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查 - 根据id
|
|
|
+ */
|
|
|
@RequestMapping("getEntityById")
|
|
|
- public AjaxJson getEntityById(Long id){
|
|
|
+ public AjaxJson getEntityById(Long id) {
|
|
|
TbInvoiceInfo t = tbInvoiceInfoService.getEntityById(id);
|
|
|
return AjaxJson.getSuccessData(t);
|
|
|
}
|
|
|
|
|
|
- /** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
|
|
|
- @RequestMapping("getList")
|
|
|
- public AjaxJson getList() {
|
|
|
- SoMap so = SoMap.getRequestSoMap();
|
|
|
+ /**
|
|
|
+ * 查集合 - 根据条件(参数为空时代表忽略指定条件)
|
|
|
+ */
|
|
|
+ @RequestMapping("getList")
|
|
|
+ public AjaxJson getList() {
|
|
|
+ SoMap so = SoMap.getRequestSoMap();
|
|
|
String cusotmerId = StpUserUtil.getCustomerId();
|
|
|
if (!StrUtil.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId(), cusotmerId)) {
|
|
|
so.put("customerId", cusotmerId);
|
|
|
}
|
|
|
- List<TbInvoiceInfo> list = tbInvoiceInfoService.getList(so.startPage());
|
|
|
- return AjaxJson.getPageData(so.getDataCount(), list);
|
|
|
- }
|
|
|
+ List<TbInvoiceInfo> list = tbInvoiceInfoService.getList(so.startPage());
|
|
|
+ return AjaxJson.getPageData(so.getDataCount(), list);
|
|
|
+ }
|
|
|
|
|
|
- /** 生成信息 */
|
|
|
+ /**
|
|
|
+ * 生成信息
|
|
|
+ */
|
|
|
@RequestMapping("generate")
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public AjaxJson generate(){
|
|
|
+ public AjaxJson generate() {
|
|
|
SoMap so = SoMap.getRequestSoMap();
|
|
|
tbInvoiceInfoService.generate(so);
|
|
|
return AjaxJson.getSuccess();
|
|
|
}
|
|
|
|
|
|
- /** 生成信息 */
|
|
|
+ /**
|
|
|
+ * 修改发票号
|
|
|
+ * @param id
|
|
|
+ * @param invoiceNo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("updateInvoiceNo")
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public AjaxJson updateInvoiceNo(@RequestParam Long id, @RequestParam String invoiceNo) {
|
|
|
+ TbInvoiceInfo tbInvoiceInfo = tbInvoiceInfoService.getById(id);
|
|
|
+ tbInvoiceInfo.setInvoiceNo(invoiceNo)
|
|
|
+ .setUpdateBy(StpUserUtil.getAdmin().getName())
|
|
|
+ .setUpdateTime(new Date());
|
|
|
+ tbInvoiceInfoService.updateById(tbInvoiceInfo);
|
|
|
+ return AjaxJson.getSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生成信息
|
|
|
+ */
|
|
|
@RequestMapping("complete")
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public AjaxJson complete(){
|
|
|
+ public AjaxJson complete() {
|
|
|
SoMap so = SoMap.getRequestSoMap();
|
|
|
tbInvoiceInfoService.complete(so);
|
|
|
return AjaxJson.getSuccess();
|
|
|
}
|
|
|
|
|
|
- /** 查 收费明细 */
|
|
|
+ /**
|
|
|
+ * 查 收费明细
|
|
|
+ */
|
|
|
@RequestMapping("getDetailsById")
|
|
|
- public AjaxJson getDetailsById(String id){
|
|
|
+ public AjaxJson getDetailsById(String id) {
|
|
|
List<FeeDeatilsGroup> feeDetails = tbInvoiceInfoService.getDetailsById(id);
|
|
|
return AjaxJson.getSuccessData(feeDetails);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // ------------------------- 前端接口 -------------------------
|
|
|
-
|
|
|
-
|
|
|
- /** 改 - 不传不改 [G] */
|
|
|
- @RequestMapping("updateByNotNull")
|
|
|
- public AjaxJson updateByNotNull(Long id){
|
|
|
- AjaxError.throwBy(true, "如需正常调用此接口,请删除此行代码");
|
|
|
- // 鉴别身份,是否为数据创建者
|
|
|
- long userId = SP.publicMapper.getColumnByIdToLong(TbInvoiceInfo.TABLE_NAME, "user_id", id);
|
|
|
- AjaxError.throwBy(userId != StpUserUtil.getLoginIdAsLong(), "此数据您无权限修改");
|
|
|
- // 开始修改 (请只保留需要修改的字段)
|
|
|
- SoMap so = SoMap.getRequestSoMap();
|
|
|
- so.clearNotIn("id", "customerId", "customerName", "totalMoney", "status", "invoiceTime", "invoiceNo", "entityId", "entityName", "taxIdNo", "address", "phone", "bank", "bankNo", "email", "createTime").clearNull().humpToLineCase();
|
|
|
- int line = SP.publicMapper.updateBySoMapById(TbInvoiceInfo.TABLE_NAME, so, id);
|
|
|
- return AjaxJson.getByLine(line);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
|
|
|
}
|