apzl_leasing/src_tenwa/com/tenwa/customer/controller/group/CustomerGroupCompanyController.java

245 lines
7.5 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.tenwa.customer.controller.group;
import java.util.List;
import java.util.Map;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.BizObjectQuery;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
import com.tenwa.reckon.util.Conn;
import jbo.app.tenwa.customer.CUSTOMER_GROUP_COMPANY;
import jbo.app.tenwa.customer.DISTRIBUTOR_GROUP_COMPANY;
import jbo.app.tenwa.customer.DISTRIBUTOR_GROUP_RELATION;
import jbo.app.tenwa.customer.DISTRIBUTOR_INFO;
import jbo.com.tenwa.entity.comm.own.COUNTRY_DISTRICT_INFO;
import jbo.sys.CODE_LIBRARY;
public class CustomerGroupCompanyController {
private String id = "";
private String group_name = "";
private String group_no = "";
private String DISTRIBUTOR_CODING = "";
private String flowunid;
private String ITEMNO = "";
private String SORTNO = "";
private String contractId;
public String getITEMNO() {
return ITEMNO;
}
public void setITEMNO(String iTEMNO) {
ITEMNO = iTEMNO;
}
public String getSORTNO() {
return SORTNO;
}
public void setSORTNO(String sORTNO) {
SORTNO = sORTNO;
}
public String getFlowunid() {
return flowunid;
}
public void setFlowunid(String flowunid) {
this.flowunid = flowunid;
}
public String getDISTRIBUTOR_CODING() {
return DISTRIBUTOR_CODING;
}
public void setDISTRIBUTOR_CODING(String dISTRIBUTOR_CODING) {
DISTRIBUTOR_CODING = dISTRIBUTOR_CODING;
}
public String getGroup_name() {
return group_name;
}
public void setGroup_name(String group_name) {
this.group_name = group_name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getGroup_no() {
return group_no;
}
public void setGroup_no(String group_no) {
this.group_no = group_no;
}
public String getContractId() {
return contractId;
}
public void setContractId(String contractId) {
this.contractId = contractId;
}
/**
* <20><><EFBFBD><EFBFBD>
* @param tx
* @return
* @throws Exception
*/
public String del(JBOTransaction tx)throws Exception{
BizObjectManager bom = JBOFactory.getBizObjectManager(CUSTOMER_GROUP_COMPANY.CLASS_NAME);
tx.join(bom);
//<2F><><EFBFBD>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>״̬
BizObjectQuery boq = bom.createQuery("update O set status = 'status03' where id=:id ");
boq.setParameter("id",id);
int i = boq.executeUpdate();
if(i == 1){
return "true";
}
return "false";
}
public String dis_del(JBOTransaction tx)throws Exception{
BizObjectManager bom = JBOFactory.getBizObjectManager(DISTRIBUTOR_GROUP_COMPANY.CLASS_NAME);
tx.join(bom);
//<2F><><EFBFBD>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>״̬
BizObjectQuery boq = bom.createQuery("update O set status = 'status03' where id=:id ");
boq.setParameter("id",id);
int i = boq.executeUpdate();
if(i == 1){
return "true";
}
return "false";
}
public String deleterelation(JBOTransaction tx)throws Exception{
BizObjectManager bom = JBOFactory.getBizObjectManager(DISTRIBUTOR_GROUP_RELATION.CLASS_NAME);
tx.join(bom);
//<2F><><EFBFBD>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>״̬
BizObjectQuery boq = bom.createQuery("delete from O where id=:id ");
boq.setParameter("id",id);
int i = boq.executeUpdate();
if(i == 1){
return "true";
}
return "false";
}
/**
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD><EFBFBD>ظ<EFBFBD>
* @param tx
* @return
* @throws Exception
*/
public String group_name(JBOTransaction tx)throws Exception{
BizObjectManager bom = JBOFactory.getBizObjectManager(CUSTOMER_GROUP_COMPANY.CLASS_NAME);
tx.join(bom);
//<2F><>ѯ<EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ѵ<EFBFBD><D1B4><EFBFBD>
BizObject CUSTOMER_GROUP_COMPANY = bom.createQuery("group_name=:group_name").setParameter("group_name",group_name).getSingleResult(false);
if(CUSTOMER_GROUP_COMPANY != null){
return CUSTOMER_GROUP_COMPANY.getAttribute("status").toString();
}else{
return "false";
}
}
public String distributor_group_name(JBOTransaction tx)throws Exception{
BizObjectManager bom = JBOFactory.getBizObjectManager(DISTRIBUTOR_GROUP_COMPANY.CLASS_NAME);
tx.join(bom);
//<2F><>ѯ<EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ѵ<EFBFBD><D1B4><EFBFBD>
BizObject CUSTOMER_GROUP_COMPANY = bom.createQuery("group_name=:group_name").setParameter("group_name",group_name).getSingleResult(false);
if(CUSTOMER_GROUP_COMPANY != null){
return CUSTOMER_GROUP_COMPANY.getAttribute("status").toString();
}else{
return "false";
}
}
public String checkCode(JBOTransaction tx)throws Exception{
BizObjectManager bom = JBOFactory.getBizObjectManager(COUNTRY_DISTRICT_INFO.CLASS_NAME);
tx.join(bom);
//<2F><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ѵ<EFBFBD><D1B4><EFBFBD>
BizObject CUSTOMER_GROUP_COMPANY = bom.createQuery("district_code=:district_code").setParameter("district_code",group_name).getSingleResult(false);
if(CUSTOMER_GROUP_COMPANY != null){
return "false";
}else{
return "success";
}
}
public String distributor_group_no(JBOTransaction tx) throws Exception{
BizObjectManager dgcm = JBOFactory.getBizObjectManager(DISTRIBUTOR_GROUP_COMPANY.CLASS_NAME);
BizObject dgc = dgcm.createQuery("group_no=:group_no").setParameter("group_no", group_no).getSingleResult(false);
if(dgc == null){
return "true";
}else{
return "false";
}
}
public String distributor_basic(JBOTransaction tx) throws Exception{
BizObjectManager dgcm = JBOFactory.getBizObjectManager(DISTRIBUTOR_INFO.CLASS_NAME);
BizObject dgc = dgcm.createQuery("DISTRIBUTOR_CODING=:DISTRIBUTOR_CODING").setParameter("DISTRIBUTOR_CODING", DISTRIBUTOR_CODING).getSingleResult(false);
if(dgc == null){
return "true";
}else{
return "false";
}
}
//<2F>жϾ<D0B6><CFBE><EFBFBD><EFBFBD>̱<EFBFBD><CCB1><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>ǵ<EFBFBD>ǰҳ<C7B0><D2B3>
/*public String distributor_basicS(JBOTransaction tx) throws Exception{
BizObjectManager dgcm = JBOFactory.getBizObjectManager(DISTRIBUTOR_INFO_TEMP.CLASS_NAME);
BizObject dgc = dgcm.createQuery("flowunid=:flowunid").setParameter("flowunid", this.flowunid).getSingleResult(true);
String distributor_coding = dgc.getAttribute("DISTRIBUTOR_CODING").toString();
return distributor_coding;
}*/
public String getNewId(JBOTransaction tx) throws Exception{
String id="";
BizObjectManager dgcm = JBOFactory.getBizObjectManager(DISTRIBUTOR_GROUP_COMPANY.CLASS_NAME);
BizObject dgc = dgcm.createQuery("group_no=:group_no").setParameter("group_no", group_no).getSingleResult(false);
if(dgc != null){
id= dgc.getAttribute("ID").getString();
}
return id;
}
//У<><D0A3><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><E5B5A5><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ψһ
public String file_repeat(JBOTransaction tx) throws Exception{
BizObjectManager filedc = JBOFactory.getBizObjectManager(CODE_LIBRARY.CLASS_NAME);
BizObject dgfc = filedc.createQuery("ITEMNO=:ITEMNO and codeno='DocList'").setParameter("ITEMNO", ITEMNO).getSingleResult(false);
if(dgfc == null){
return "true";
}else{
return "false";
}
}
//У<><EFBFBD><E9BEAD><EFBFBD>̶<EFBFBD><CCB6><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>
public String checkTotal(JBOTransaction tx) throws Exception{
Conn conn = new Conn(tx);
String sql = "SELECT IFNULL(di.relines,0)-IFNULL(lcc.CLEAN_LEASE_MONEY,0) total,di.CHANNELTYPE FROM lb_contract_info lci LEFT JOIN vi_distributor_lines di ON di.distributor_no=lci.distributor_id LEFT JOIN LC_CALC_CONDITION lcc ON lcc.contract_id=lci.id WHERE lci.id=? ";
List<Map<String, String>> results = conn.executeQuery(sql, this.contractId);
String istotal = results.get(0).get("total");
String channeltype = results.get(0).get("channeltype");
if("01".equals(channeltype) && new Double(istotal) <= 0){
return "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD><EFBFBD>Ȳ<EFBFBD><EFBFBD>";
}
return "true";
}
}