Переглянути джерело

新增:企业类型管理。

lym 4 роки тому
батько
коміт
7f37595135

+ 27 - 0
carbon-admin/carbon-admin-service/src/main/java/com/hcloud/microserver/bank/controller/CustomerCompanyTypeController.java

@@ -8,6 +8,7 @@ import com.hcloud.microserver.commoncore.base.ResultVO;
 import com.hcloud.microserver.commoncore.enums.ResultEnum;
 import com.hcloud.microserver.facade.carbon.entity.CustomerCompanyType;
 import com.hcloud.microserver.facade.carbon.forms.CustomerCompanyTypeForm;
+import io.swagger.annotations.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -16,11 +17,17 @@ import java.util.List;
 
 @RestController
 @RequestMapping("/customerCompanyType")
+@Api(description = "企业类型管理")
 public class CustomerCompanyTypeController extends BaseController {
 
     @Autowired
     private CustomerCompanyTypeService customerCompanyTypeService;
 
+    @ApiOperation(value = "企业类型添加")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "customerCompanyType",value = "企业类型信息",dataType = "CustomerCompanyType")
+    })
+    @ApiResponse(code = 0, message = "操作成功")
     @PostMapping("/save")
     public ResponseBase save(@RequestBody @Valid CustomerCompanyType customerCompanyType){
         int i = customerCompanyTypeService.saveSelective(customerCompanyType);
@@ -33,6 +40,11 @@ public class CustomerCompanyTypeController extends BaseController {
        return responseSuccess(resultVO);
     }
 
+    @ApiOperation(value = "企业类型修改")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "customerCompanyType",value = "企业类型信息",dataType = "CustomerCompanyType")
+    })
+    @ApiResponse(code = 0, message = "操作成功")
     @PostMapping("/update")
     public ResponseBase update(@RequestBody @Valid CustomerCompanyType customerCompanyType){
         int i = customerCompanyTypeService.modifyByPrimaryKeySelective(customerCompanyType);
@@ -45,6 +57,11 @@ public class CustomerCompanyTypeController extends BaseController {
         return responseSuccess(resultVO);
     }
 
+    @ApiOperation(value = "企业类型详情")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "guid",value = "主键",dataType = "String")
+    })
+    @ApiResponse(code = 0, message = "操作成功")
     @GetMapping("/findById")
     public ResponseBase findById(@RequestParam("guid") String guid){
         CustomerCompanyType customerCompanyType = customerCompanyTypeService.queryByPrimaryKey(guid);
@@ -53,6 +70,11 @@ public class CustomerCompanyTypeController extends BaseController {
         return responseSuccess(resultVO);
     }
 
+    @ApiOperation(value = "企业类型信息删除")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "guid",value = "主键",dataType = "String")
+    })
+    @ApiResponse(code = 0, message = "操作成功")
     @GetMapping("/delete")
     public ResponseBase delete(@RequestParam("guid") String guid){
         int i = customerCompanyTypeService.delByPrimaryKey(guid);
@@ -65,6 +87,11 @@ public class CustomerCompanyTypeController extends BaseController {
         return responseSuccess(resultVO);
     }
 
+    @ApiOperation(value = "企业类型列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "customerCompanyTypeForm",value = "企业类型信息",dataType = "CustomerCompanyTypeForm")
+    })
+    @ApiResponse(code = 0, message = "操作成功")
     @PostMapping("/list")
     public ResponseBase selectList(@RequestBody CustomerCompanyTypeForm customerCompanyTypeForm){
         PageInfo<List<CustomerCompanyType>> pageInfo = customerCompanyTypeService.selectList(customerCompanyTypeForm);

+ 7 - 0
carbon-admin/carbon-admin-service/src/main/java/com/hcloud/microserver/bank/dao/CustomerCompanyTypeMapper.java

@@ -22,4 +22,11 @@ public interface CustomerCompanyTypeMapper extends BaseMapper<CustomerCompanyTyp
      * @return
      */
     List<CustomerCompanyType> selectList(CustomerCompanyTypeForm customerCompanyTypeForm);
+
+    /**
+     * 查询最大编码
+     * lym
+     * @return
+     */
+    String getMaxCode();
 }

+ 21 - 0
carbon-admin/carbon-admin-service/src/main/java/com/hcloud/microserver/bank/service/impl/CustomerCompanyTypeServiceImpl.java

@@ -6,6 +6,7 @@ import com.hcloud.microserver.bank.dao.CustomerCompanyTypeMapper;
 import com.hcloud.microserver.bank.service.CustomerCompanyTypeService;
 import com.hcloud.microserver.commoncore.enums.ResultEnum;
 import com.hcloud.microserver.commoncore.exception.GlobalException;
+import com.hcloud.microserver.commoncore.util.BusinessCodeRule;
 import com.hcloud.microserver.commoncore.util.GetUUID;
 import com.hcloud.microserver.commoncore.util.string.StringUtils;
 import com.hcloud.microserver.facade.carbon.entity.CustomerCompanyType;
@@ -19,6 +20,8 @@ import java.util.List;
 @Service
 public class CustomerCompanyTypeServiceImpl implements CustomerCompanyTypeService {
 
+    private static final String CODE_PREFIX = "Q";
+
     @Resource
     private CustomerCompanyTypeMapper customerCompanyTypeMapper;
 
@@ -41,6 +44,7 @@ public class CustomerCompanyTypeServiceImpl implements CustomerCompanyTypeServic
         isExist(record);
         record.setGuid(GetUUID.getUUID());
         record.setState(1);
+        record.setTypeVal(getMaxCode());
         return customerCompanyTypeMapper.insertSelective(record);
     }
 
@@ -82,6 +86,23 @@ public class CustomerCompanyTypeServiceImpl implements CustomerCompanyTypeServic
         companyType.setModifiedTime(new Date());
     }
 
+    /**
+     * 生成最大编码
+     * lym
+     * @return
+     */
+    private String getMaxCode(){
+        StringBuffer sbb = new StringBuffer();
+        String maxCode = customerCompanyTypeMapper.getMaxCode();
+        sbb.append(CODE_PREFIX);
+        int currentNum = 0;
+        if (StringUtils.isNotEmpty(maxCode)) {
+            currentNum = Integer.valueOf(maxCode.substring(sbb.toString().length()));
+        }
+        String newCode = BusinessCodeRule.notYearCodeRule(CODE_PREFIX, currentNum, 4);
+        return newCode;
+    }
+
     @Override
     public PageInfo<List<CustomerCompanyType>> selectList(CustomerCompanyTypeForm customerCompanyTypeForm) {
         PageHelper.startPage(customerCompanyTypeForm.getPageNum(),customerCompanyTypeForm.getPageSize());

+ 7 - 0
carbon-admin/carbon-admin-service/src/main/resources/com/hcloud/microserver/bank/dao/CustomerCompanyTypeMapper.xml

@@ -151,5 +151,12 @@
     <if test="typeName != null and typeName != ''">
       AND type_name LIKE CONCAT("%",#{typeName},"%")
     </if>
+    ORDER BY modified_time DESC
+  </select>
+
+  <!-- 查询最大编码 lym -->
+  <select id="getMaxCode" resultType="String">
+    SELECT MAX(type_val) FROM t_customer_company_type
+    where state = 1
   </select>
 </mapper>