Browse Source

Merge branch 'dev' of ssh://10.10.100.21/source/saas-platform into dev

rainco 7 years ago
parent
commit
88e5417547

+ 2 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/FundinouttypeMapper.java

@@ -7,6 +7,7 @@ import com.usoftchina.saas.document.entities.Fundinouttype;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 public interface FundinouttypeMapper extends CommonBaseMapper<Fundinouttype> {
     int deleteByPrimaryKey(Long ft_id);
@@ -26,4 +27,5 @@ public interface FundinouttypeMapper extends CommonBaseMapper<Fundinouttype> {
     List<ComboDTO> getCombo(@Param("companyId") Long companyId,@Param("condition") String condition);
 
     List<Fundinouttype> selectAll(@Param("companyId") Long companyId);
+    void check(Map<String, Object> map);
 }

+ 28 - 3
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/FundinouttypeServiceImpl.java

@@ -13,15 +13,20 @@ import com.usoftchina.saas.document.service.FundinouttypeService;
 import com.usoftchina.saas.exception.BizException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
 
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 @Service
 public class FundinouttypeServiceImpl extends CommonBaseServiceImpl<FundinouttypeMapper, Fundinouttype> implements FundinouttypeService {
 
     @Autowired
     private MessageLogService messageLogService;
+    @Autowired
+    private FundinouttypeMapper fundinouttypeMapper;
 
     /**
      * 保存/更新
@@ -63,10 +68,30 @@ public class FundinouttypeServiceImpl extends CommonBaseServiceImpl<Fundinouttyp
      */
     @Override
     public boolean removeByPrimaryKey(Long id){
+        Fundinouttype fundinouttype = getMapper().selectByPrimaryKey(id);
+        String kind = fundinouttype.getFt_kind();
+        int v_id = 0;
+        if ("收入".equals(kind)){
+            v_id = 1;
+        }else {
+            v_id = 0;
+        }
         if(id != null && id > 0){
-            getMapper().deleteByPrimaryKey(id);
-            //记录LOG
-            messageLogService.delete(generateMsgObj(id));
+            Map<String, Object> map = new HashMap<String, Object>();
+            map.put("v_id",v_id);
+            map.put("v_code", fundinouttype.getFt_name());
+            map.put("v_type","fund");
+            map.put("v_companyid",BaseContextHolder.getCompanyId());
+            map.put("v_res","");
+            fundinouttypeMapper.check(map);
+            Object result =  map.get("v_res");
+            if(!StringUtils.isEmpty(result)){
+                throw new BizException(BizExceptionCode.USING_EXISTS.getCode(),result.toString());
+            }else {
+                getMapper().deleteByPrimaryKey(id);
+                //记录LOG
+                messageLogService.delete(generateMsgObj(id));
+            }
         }
         return true;
     }

+ 11 - 0
applications/document/document-server/src/main/resources/mapper/FundinouttypeMapper.xml

@@ -167,4 +167,15 @@
           </if>
         </where>
     </select>
+
+  <select id="check" parameterMap="checkParamMap" statementType="CALLABLE">
+        CALL SP_LIMITBASE(?, ?, ?, ?,?)
+    </select>
+  <parameterMap id="checkParamMap" type="java.util.Map">
+    <parameter property="v_type" jdbcType="VARCHAR" mode="IN" />
+    <parameter property="v_id" jdbcType="INTEGER" mode="IN" />
+    <parameter property="v_code" jdbcType="VARCHAR" mode="IN" />
+    <parameter property="v_companyid" jdbcType="INTEGER" mode="IN" />
+    <parameter property="v_res" jdbcType="VARCHAR" mode="OUT" />
+  </parameterMap>
 </mapper>