去掉财务管理从后台获取最大id的逻辑
This commit is contained in:
@@ -5,6 +5,7 @@ import com.jsh.erp.constants.BusinessConstants;
|
||||
import com.jsh.erp.constants.ExceptionConstants;
|
||||
import com.jsh.erp.datasource.entities.AccountHead;
|
||||
import com.jsh.erp.datasource.entities.AccountHeadVo4ListEx;
|
||||
import com.jsh.erp.exception.BusinessParamCheckingException;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.accountHead.AccountHeadService;
|
||||
import com.jsh.erp.utils.BaseResponseInfo;
|
||||
@@ -182,5 +183,38 @@ public class AccountHeadController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 新增财务信息和财务明细信息
|
||||
* create time: 2019/5/21 15:50
|
||||
* @Param: beanJson
|
||||
* @Param: inserted
|
||||
* @Param: deleted
|
||||
* @Param: updated
|
||||
* @Param: request
|
||||
* @return java.lang.Object
|
||||
*/
|
||||
@RequestMapping(value = "/addAccountHeadAndDetail")
|
||||
public Object addAccountHeadAndDetail(@RequestParam("info") String beanJson,
|
||||
@RequestParam("inserted") String inserted,
|
||||
@RequestParam("deleted") String deleted,
|
||||
@RequestParam("updated") String updated,
|
||||
@RequestParam("listType") String listType,HttpServletRequest request) throws Exception{
|
||||
|
||||
JSONObject result = ExceptionConstants.standardSuccess();
|
||||
accountHeadService.addAccountHeadAndDetail(beanJson,inserted,deleted,updated,listType);
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/updateAccountHeadAndDetail")
|
||||
public Object updateAccountHeadAndDetail(@RequestParam("id") Long id,@RequestParam("info") String beanJson,@RequestParam("inserted") String inserted,
|
||||
@RequestParam("deleted") String deleted,
|
||||
@RequestParam("updated") String updated,@RequestParam("listType") String listType) throws Exception{
|
||||
|
||||
JSONObject result = ExceptionConstants.standardSuccess();
|
||||
accountHeadService.updateAccountHeadAndDetail(id,beanJson,inserted,deleted,updated,listType);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,4 +43,7 @@ public interface AccountHeadMapperEx {
|
||||
List<AccountHead> getAccountHeadListByOrganIds(@Param("organIds") String[] organIds);
|
||||
|
||||
List<AccountHead> getAccountHeadListByHandsPersonIds(@Param("handsPersonIds") String[] handsPersonIds);
|
||||
|
||||
int addAccountHead(AccountHead accountHead);
|
||||
int updateAccountHead(AccountHead accountHead);
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import com.jsh.erp.datasource.mappers.AccountHeadMapper;
|
||||
import com.jsh.erp.datasource.mappers.AccountHeadMapperEx;
|
||||
import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.service.accountItem.AccountItemService;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.service.user.UserService;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
@@ -22,6 +23,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -41,6 +43,8 @@ public class AccountHeadService {
|
||||
private LogService logService;
|
||||
@Resource
|
||||
private AccountItemMapperEx accountItemMapperEx;
|
||||
@Resource
|
||||
private AccountItemService accountItemService;
|
||||
|
||||
public AccountHead getAccountHead(long id) throws Exception {
|
||||
AccountHead result=null;
|
||||
@@ -303,4 +307,49 @@ public class AccountHeadService {
|
||||
deleteTotal= batchDeleteAccountHeadByIds(ids);
|
||||
return deleteTotal;
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public void addAccountHeadAndDetail(String beanJson, String inserted, String deleted, String updated, String listType) throws Exception {
|
||||
/**处理财务信息*/
|
||||
AccountHead accountHead = JSONObject.parseObject(beanJson, AccountHead.class);
|
||||
try{
|
||||
accountHeadMapperEx.addAccountHead(accountHead);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
||||
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
||||
}
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/22 10:30
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 处理财务明细信息
|
||||
*
|
||||
*/
|
||||
accountItemService.saveDetials(inserted, deleted, updated, accountHead.getId(), listType);
|
||||
|
||||
}
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public void updateAccountHeadAndDetail(Long id, String beanJson, String inserted, String deleted, String updated, String listType)throws Exception {
|
||||
/**更新财务信息*/
|
||||
AccountHead accountHead = JSONObject.parseObject(beanJson, AccountHead.class);
|
||||
accountHead.setId(id);
|
||||
try{
|
||||
accountHeadMapperEx.updateAccountHead(accountHead);
|
||||
}catch(Exception e){
|
||||
logger.error("异常码[{}],异常提示[{}],异常[{}]",
|
||||
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
|
||||
ExceptionConstants.DATA_WRITE_FAIL_MSG);
|
||||
}
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/22 10:30
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 更新财务明细信息
|
||||
*/
|
||||
accountItemService.saveDetials(inserted, deleted, updated, accountHead.getId(), listType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,4 +126,56 @@
|
||||
)
|
||||
and ifnull(delete_Flag,'0') !='1'
|
||||
</select>
|
||||
<insert id="addAccountHead" parameterType="com.jsh.erp.datasource.entities.AccountHead"
|
||||
useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
||||
insert into jsh_accounthead (Id, Type, OrganId,
|
||||
HandsPersonId, ChangeAmount, TotalPrice,
|
||||
AccountId, BillNo, BillTime,
|
||||
Remark, tenant_id, delete_Flag
|
||||
)
|
||||
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{organid,jdbcType=BIGINT},
|
||||
#{handspersonid,jdbcType=BIGINT}, #{changeamount,jdbcType=DECIMAL}, #{totalprice,jdbcType=DECIMAL},
|
||||
#{accountid,jdbcType=BIGINT}, #{billno,jdbcType=VARCHAR}, #{billtime,jdbcType=TIMESTAMP},
|
||||
#{remark,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<update id="updateAccountHead" parameterType="com.jsh.erp.datasource.entities.AccountHead">
|
||||
update jsh_accounthead
|
||||
<set>
|
||||
<if test="type != null">
|
||||
Type = #{type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="organid != null">
|
||||
OrganId = #{organid,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="handspersonid != null">
|
||||
HandsPersonId = #{handspersonid,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="changeamount != null">
|
||||
ChangeAmount = #{changeamount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="totalprice != null">
|
||||
TotalPrice = #{totalprice,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="accountid != null">
|
||||
AccountId = #{accountid,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="billno != null">
|
||||
BillNo = #{billno,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="billtime != null">
|
||||
BillTime = #{billtime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
Remark = #{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
tenant_id = #{tenantId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="deleteFlag != null">
|
||||
delete_Flag = #{deleteFlag,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where Id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user