|
|
|
@ -53,6 +53,7 @@ import com.github.miemiedev.mybatis.paginator.domain.Order;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
|
|
import org.apache.commons.lang3.RandomUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
|
@ -1339,15 +1340,33 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject getCheckClientInfo(JSONObject device) {
|
|
|
|
|
JSONObject result = clientContractService.getClientContractExpire(device.getIntValue("client_id"));
|
|
|
|
|
JSONObject account = clientAccountMapper.findById(device.getString("account_id"));
|
|
|
|
|
if(PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER){
|
|
|
|
|
result.put("is_ordinary",true);
|
|
|
|
|
JSONObject config = sysConfigManager.getSysConfig();
|
|
|
|
|
boolean expire = result.getBoolean("rate_expire");
|
|
|
|
|
boolean waring = result.getBoolean("rate_waring");
|
|
|
|
|
if (PartnerRole.getRole(device.getIntValue("role")) == PartnerRole.CASHIER) {
|
|
|
|
|
result.put("is_ordinary", true);
|
|
|
|
|
if (!expire && waring) {
|
|
|
|
|
String[] key = { result.getString("expire_days") };
|
|
|
|
|
result.put("contract_info", editContractOrdinaryWaring(key, config.getString("sys_contract_ordinary_waring")));
|
|
|
|
|
}
|
|
|
|
|
if (expire) {
|
|
|
|
|
result.put("contract_info", config.getString("sys_contract_ordinary_info"));
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
} else {
|
|
|
|
|
result.put("contract_info", config.getString("sys_contract_info"));
|
|
|
|
|
result.put("is_ordinary", false);
|
|
|
|
|
if (!expire && waring) {
|
|
|
|
|
String[] key = { result.getString("expire_days") };
|
|
|
|
|
result.put("contract_info", editContractOrdinaryWaring(key, config.getString("sys_contract_waring")));
|
|
|
|
|
}
|
|
|
|
|
if (expire) {
|
|
|
|
|
result.put("contract_info", config.getString("sys_contract_info"));
|
|
|
|
|
}
|
|
|
|
|
JSONObject file = clientContractService.getOrGenerateSourceAgreement(device.getIntValue("client_id"));
|
|
|
|
|
result.put("file_url", file.getString("file_value"));
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
JSONObject file = clientContractService.getOrGenerateSourceAgreement(device.getIntValue("client_id"));
|
|
|
|
|
result.put("file_url", file.getString("file_value"));
|
|
|
|
|
result.put("contract_info",sysConfigManager.getSysConfig().getString("sys_contract_info"));
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static boolean mathchLetterorNum(String str) {
|
|
|
|
@ -1355,4 +1374,13 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
|
return str.matches(regex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String editContractOrdinaryWaring(String[] key, String sourceStr) {
|
|
|
|
|
if (StringUtils.isEmpty(sourceStr) || ArrayUtils.isEmpty(key)) {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < key.length; i++) {
|
|
|
|
|
sourceStr = sourceStr.replace("{" + i + "}", key[i]);
|
|
|
|
|
}
|
|
|
|
|
return sourceStr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|